lkml.org 
[lkml]   [2005]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: PCI driver
Manu Abraham wrote:
> Ralph Metzler wrote:
>

> SA_INTERRUPT, DRIVER_NAME, mantis) < 0) {
> dprintk(verbose, MANTIS_ERROR, 1, "Mantis IRQ reg failed");
> goto err2;
> }
> dprintk(verbose, MANTIS_DEBUG, 1, "We got an IRQ");
> dprintk(verbose, MANTIS_DEBUG, 1, "We finally enabled the device");
> pci_set_master(pdev);
> pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency);
> pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
> mantis->latency = latency;
> mantis->revision = revision;
> if (!latency) {
> pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 32);
> }
> pci_set_drvdata(pdev, mantis); dprintk(verbose, MANTIS_ERROR, 0,
> "Mantis Rev %d, ", mantis->revision);
> dprintk(verbose, MANTIS_ERROR, 0, "irq: %d, latency: %d\n \
> memory: 0x%04x, mmio: %p\n", pdev->irq, mantis->latency, \
> mantis->mantis_addr, mantis->mantis_mmio);

Success! So don't enter the failure path, return 0 here.

> err2:
> if (mantis->mantis_mmio)
> iounmap(mantis->mantis_mmio);
> err1:
> release_mem_region(pci_resource_start(pdev, 0),
> pci_resource_len(pdev, 0));
> err0:
> kfree(mantis);
> err:
> return 0;

This is your failure path, return nonzero here, preferable describing the
error condition.

Tony
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-09-15 14:11    [W:0.734 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site