summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKulikov Vasiliy <segooon@gmail.com>2010-08-06 23:52:57 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-31 14:48:10 -0700
commitc37c6d2196fc716abac6531c4cf08ad2874d52d8 (patch)
treee37b114b56ded85dd4f8c51bef0f6f7f427c1c75
parent918e3592b9ea865ce29bda06a7200eba80d8d5f8 (diff)
downloadlinux-3.10-c37c6d2196fc716abac6531c4cf08ad2874d52d8.tar.gz
linux-3.10-c37c6d2196fc716abac6531c4cf08ad2874d52d8.tar.bz2
linux-3.10-c37c6d2196fc716abac6531c4cf08ad2874d52d8.zip
staging: cx25821: call disable_pci_device() if pci_probe() failed
Driver should call disable_pci_device() if it returns from pci_probe() with error. Also it must not be called if pci_request_region() fails as it means that somebody uses device resources and rules the device. Signed-off-by: Kulikov Vasiliy <segooon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/cx25821/cx25821-core.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/staging/cx25821/cx25821-core.c b/drivers/staging/cx25821/cx25821-core.c
index c487c19256b..ad7ce013ba5 100644
--- a/drivers/staging/cx25821/cx25821-core.c
+++ b/drivers/staging/cx25821/cx25821-core.c
@@ -962,7 +962,7 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
dev->pci->subsystem_device);
cx25821_devcount--;
- return -ENODEV;
+ return -EBUSY;
}
/* PCIe stuff */
@@ -1412,9 +1412,12 @@ static int __devinit cx25821_initdev(struct pci_dev *pci_dev,
printk(KERN_INFO "cx25821 Athena pci enable !\n");
- if (cx25821_dev_setup(dev) < 0) {
- err = -EINVAL;
- goto fail_unregister_device;
+ err = cx25821_dev_setup(dev);
+ if (err) {
+ if (err == -EBUSY)
+ goto fail_unregister_device;
+ else
+ goto fail_unregister_pci;
}
/* print pci info */
@@ -1448,6 +1451,8 @@ fail_irq:
printk(KERN_INFO "cx25821 cx25821_initdev() can't get IRQ !\n");
cx25821_dev_unregister(dev);
+fail_unregister_pci:
+ pci_disable_device(pci_dev);
fail_unregister_device:
v4l2_device_unregister(&dev->v4l2_dev);