Skip to contentSkip to conversation

powerpc/eeh: drop taken reference to driver on eeh_rmv_device

PATCH In review Thadeu Lima de Souza Cascardo 2 participants 3 messages Feb 5, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc/eeh: drop taken reference to driver on eeh_rmv_device

Commit f5c57710dd62dd06f176934a8b4b8accbf00f9f8 ("powerpc/eeh: Use partial hotplug for EEH unaware drivers") introduces eeh_rmv_device, which may grab a reference to a driver, but not release it.

That prevents a driver from being removed after it has gone through EEH recovery.

This patch drops the reference if it was taken.

---
 arch/powerpc/kernel/eeh_driver.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/kernel/eeh_driver.c +6 -2
index 7bb30dc..fdc679d 100644
@@ -362,9 +362,13 @@ static void *eeh_rmv_device(void *data, void *userdata)
 	 */
 	if (!dev || (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE))
 		return NULL;
+
 	driver = eeh_pcid_get(dev);
-	if (driver && driver->err_handler)
-		return NULL;
+	if (driver) {
+		eeh_pcid_put(dev);
+		if (driver->err_handler)
+			return NULL;
+	}
 
 	/* Remove it from PCI subsystem */
 	pr_debug("EEH: Removing %s without EEH sensitive driver\n",
Signature · 1 line
1.7.1
#1 lore raw
Quoted 20 lines · Thadeu Lima de Souza Cascardo

Commit f5c57710dd62dd06f176934a8b4b8accbf00f9f8 ("powerpc/eeh: Use partial hotplug for EEH unaware drivers") introduces eeh_rmv_device, which may grab a reference to a driver, but not release it.

That prevents a driver from being removed after it has gone through EEH recovery.

This patch drops the reference if it was taken.

---
 arch/powerpc/kernel/eeh_driver.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/kernel/eeh_driver.c +0 -0
index 7bb30dc..fdc679d 100644

arch/powerpc/kernel/eeh_driver.c static void *eeh_rmv_device(void *data, void *userdata) · line 365

Quoted 4 lines
arch/powerpc/kernel/eeh_driver.c +1 -0
@@ -362,9 +362,13 @@ static void *eeh_rmv_device(void *data, void *userdata)
 	 */
 	if (!dev || (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE))
 		return NULL;
+

This appears to be unnecessary whitespace change?

-Nish

Quoted 19 lines
arch/powerpc/kernel/eeh_driver.c +5 -2
 	driver = eeh_pcid_get(dev);
-	if (driver && driver->err_handler)
-		return NULL;
+	if (driver) {
+		eeh_pcid_put(dev);
+		if (driver->err_handler)
+			return NULL;
+	}
 
 	/* Remove it from PCI subsystem */
 	pr_debug("EEH: Removing %s without EEH sensitive driver\n",
Signature · 6 lines
1.7.1

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
#2 lore raw
Quoted 28 lines · Nishanth Aravamudan
Quoted 20 lines · Thadeu Lima de Souza Cascardo

Commit f5c57710dd62dd06f176934a8b4b8accbf00f9f8 ("powerpc/eeh: Use partial hotplug for EEH unaware drivers") introduces eeh_rmv_device, which may grab a reference to a driver, but not release it.

That prevents a driver from being removed after it has gone through EEH recovery.

This patch drops the reference if it was taken.

---
 arch/powerpc/kernel/eeh_driver.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/kernel/eeh_driver.c +0 -0
index 7bb30dc..fdc679d 100644

arch/powerpc/kernel/eeh_driver.c static void *eeh_rmv_device(void *data, void *userdata) · line 365

Quoted 4 lines
arch/powerpc/kernel/eeh_driver.c +1 -0
@@ -362,9 +362,13 @@ static void *eeh_rmv_device(void *data, void *userdata)
 	 */
 	if (!dev || (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE))
 		return NULL;
+

This appears to be unnecessary whitespace change?

Quoted 2 lines

-Nish

Hi, Nish.

I originally add it there for readability, giving both more evidence to the code below, where a driver reference is get and put, and to the code above and its respective comment. Leaving those together could give the impression the comment also applies to the code below.

But I have no strong feelings about that.

Ben, do you want me to send a new version?

Regards.
Cascardo.

Quoted 25 lines
Quoted 19 lines
arch/powerpc/kernel/eeh_driver.c +5 -2
 	driver = eeh_pcid_get(dev);
-	if (driver && driver->err_handler)
-		return NULL;
+	if (driver) {
+		eeh_pcid_put(dev);
+		if (driver->err_handler)
+			return NULL;
+	}
 
 	/* Remove it from PCI subsystem */
 	pr_debug("EEH: Removing %s without EEH sensitive driver\n",
Signature · 6 lines
1.7.1

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev