Skip to contentSkip to conversation

drivers/char/istallion.c : change pci_find_device by

PATCH In review trem 2 participants 5 messages May 16, 2006 – May 20, 2006

Subsystems (2)
lore
Share & tools
lore

trem

author
#0 lore raw

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
index ef20c1f..8ba6a1d 100644
@@ -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

#1 lore raw
Quoted 5 lines · trem

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.

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

author
#2 lore raw

PATCH 1/1 drivers/char/istallion.c : change pci_find_device by

In reply to trem

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. 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
index ef20c1f..b10eea7 100644
@@ -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

#3 lore raw
In reply to trem
Quoted 19 lines · trem

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. 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 +0 -0
index ef20c1f..b10eea7 100644
@@ -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

author
#4 lore raw

PATCH 1/1 drivers/char/istallion.c : replace pci_find_device by

In reply to trem

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 when the loop is broken, so unload could be done.

---

drivers/char/istallion.c +4 -2
index ef20c1f..83002d5 100644
@@ -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