Re: [PATCH] ip2: Remove #ifdef MODULE from ip2main.c

From: Rakib Mullick
Date: Fri Dec 04 2009 - 04:38:01 EST


On 12/4/09, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, 1 Dec 2009 15:02:56 +0600 Rakib Mullick <rakib.mullick@xxxxxxxxx> wrote:
>
> x86_64 allmodconfig:
>
> drivers/char/ip2/ip2main.c: In function 'ip2_loadmain':
>
> drivers/char/ip2/ip2main.c:657: error: 'pdev' undeclared (first use in this function)
> drivers/char/ip2/ip2main.c:657: error: (Each undeclared identifier is reported only once
> drivers/char/ip2/ip2main.c:657: error: for each function it appears in.)
>
Yes, I've also notice that pci_dev_put was outside of the #ifdef CONFIG_PCI
context. I was about to make patch for this.
>
> I suppose this:
>
> but it needs checking - does pci_get_device() need a balancing pci_dev_put()?

I thinks - yes. Otherwise we've to face ref counting problem.
And when pci_enable_device fails we need to make sure that we're
calling pci_dev_put.

So.. please checkout the following patch. Following patch has
been made without applying 'ip2-remove-ifdef-module-from-ip2mainc-fix' patch.
Please just check is it okay or not.

---
--- linus/drivers/char/ip2/ip2main.c 2009-12-01 12:41:53.000000000 +0600
+++ rakib/drivers/char/ip2/ip2main.c 2009-12-04 16:32:22.000000000 +0600
@@ -626,7 +626,7 @@ static int __init ip2_loadmain(void)

if (pci_enable_device(pdev)) {
dev_err(&pdev->dev, "can't enable device\n");
- break;
+ goto out;
}
ip2config.type[i] = PCI;
ip2config.pci_dev[i] = pci_dev_get(pdev);
@@ -638,6 +638,8 @@ static int __init ip2_loadmain(void)
dev_err(&pdev->dev, "I/O address error\n");

ip2config.irq[i] = pdev->irq;
+out:
+ pci_dev_put(pdev);
}
#else
printk(KERN_ERR "IP2: PCI card specified but PCI "
@@ -656,7 +658,6 @@ static int __init ip2_loadmain(void)
break;
} /* switch */
} /* for */
- pci_dev_put(pdev);

for (i = 0; i < IP2_MAX_BOARDS; ++i) {
if (ip2config.addr[i]) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/