drivers/char/istallion.c : change pci_find_device by
Subsystems (2)
PATCH 1/1 drivers/char/istallion.c : change pci_find_device by
From: trem <[email protected]>
This patch simply change pci_find_device by pci_get_device, because pci_find_device is deprecated. pci_dev_put has been added to decrement the counter, so unload could be done.
---
drivers/char/istallion.c +2 -1
@@ -4576,10 +4576,11 @@ static int stli_findpcibrds(void)printk ("stli_findpcibrds()\n" );#endif -while ((dev =pci_find_device (PCI_VENDOR_ID_STALLION , +while ((dev =pci_get_device (PCI_VENDOR_ID_STALLION ,PCI_DEVICE_ID_ECRA , dev))) {if ((rc =stli_initpcibrd (BRD_ECPPCI , dev)))return (rc); +pci_dev_put (dev); }return (0 );
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 5 lines · trem
From: trem <[email protected]>
This patch simply change
pci_find_devicebypci_get_device, becausepci_find_deviceis deprecated.pci_dev_puthas been added to decrement the counter, so unload could be done.
Huh? No, this patch is wrong, you are leaking a reference count, and causing others to drop down to 0 accidentally.
Do NOT apply this.
thanks,
greg k-h
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
PATCH 1/1 drivers/char/istallion.c : change pci_find_device by
In reply to tremFrom: trem <[email protected]>
This patch simply change pci_find_device by pci_get_device, because pci_find_device is deprecated. pci_dev_put has been added to decrement the counter, so unload could be done. I've added a pci_dev_put(dev) before the return to avoid missing one device (thanks greg k-h for the remark)
---
drivers/char/istallion.c +5 -2
@@ -4576,10 +4576,13 @@ static int stli_findpcibrds(void)printk ("stli_findpcibrds()\n" );#endif -while ((dev =pci_find_device (PCI_VENDOR_ID_STALLION , +while ((dev =pci_get_device (PCI_VENDOR_ID_STALLION ,PCI_DEVICE_ID_ECRA , dev))) { -if ((rc =stli_initpcibrd (BRD_ECPPCI , dev))) +if ((rc =stli_initpcibrd (BRD_ECPPCI , dev))) { +pci_dev_put (dev);return (rc); + } +pci_dev_put (dev); }return (0 );
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 19 lines · trem
From: trem <[email protected]>
This patch simply change
pci_find_devicebypci_get_device, becausepci_find_deviceis deprecated.pci_dev_puthas been added to decrement the counter, so unload could be done. I've added apci_dev_put(dev)before the return to avoid missing one device (thanks greg k-h for the remark)Signed-off-by trem <[email protected]>---
drivers/char/istallion.c +0
-0@@ -4576,10 +4576,13 @@ static int stli_findpcibrds(void)printk ("stli_findpcibrds()\n" );#endif
drivers/char/istallion.c static int stli_findpcibrds(void) · line 4585
Quoted 10 lines
drivers/char/istallion.c +5
-2-while ((dev =pci_find_device (PCI_VENDOR_ID_STALLION , +while ((dev =pci_get_device (PCI_VENDOR_ID_STALLION ,PCI_DEVICE_ID_ECRA , dev))) { -if ((rc =stli_initpcibrd (BRD_ECPPCI , dev))) +if ((rc =stli_initpcibrd (BRD_ECPPCI , dev))) { +pci_dev_put (dev);return (rc); + } +pci_dev_put (dev);
No, this is still wrong. Please read the documentation on how to use this function.
thanks,
greg k-h
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
PATCH 1/1 drivers/char/istallion.c : replace pci_find_device by
In reply to tremFrom: trem <[email protected]>
This patch simply change pci_find_device by pci_get_device, because pci_find_device is deprecated. pci_dev_put has been added to decrement the counter when the loop is broken, so unload could be done.
---
drivers/char/istallion.c +4 -2
@@ -4576,10 +4576,12 @@ static int stli_findpcibrds(void)printk ("stli_findpcibrds()\n" );#endif -while ((dev =pci_find_device (PCI_VENDOR_ID_STALLION , +while ((dev =pci_get_device (PCI_VENDOR_ID_STALLION ,PCI_DEVICE_ID_ECRA , dev))) { -if ((rc =stli_initpcibrd (BRD_ECPPCI , dev))) +if ((rc =stli_initpcibrd (BRD_ECPPCI , dev))) { +pci_dev_put (dev);return (rc); + } }return (0 );
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors