Skip to contentSkip to conversation

ACPI: Unbind ACPI drv when probe failed

PATCH In review Toshi Kani 2 participants 3 messages Feb 7, 2013 ACPI

lore
Share & tools
lore

Toshi Kani

author
#0 lore raw

PATCH 1/1 ACPI: Unbind ACPI drv when probe failed

When acpi_device_install_notify_handler() failed in acpi_device_probe(), it calls acpi_drv->ops.remove() and fails the probe. However, the ACPI driver is left bound to the acpi_device. Fix it by clearing the driver and driver_data fields.

---
This patch is based on linux-pm.git/bleeding-edge.

---
 drivers/acpi/scan.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/scan.c +2 -0
index d6caf1d..39659bb 100644
@@ -627,6 +627,8 @@ static int acpi_device_probe(struct device * dev)
 			if (ret) {
 				if (acpi_drv->ops.remove)
 					acpi_drv->ops.remove(acpi_dev);
+				acpi_dev->driver = NULL;
+				acpi_dev->driver_data = NULL;
 				return ret;
 			}
 		}
#1 lore raw
Quoted 8 lines · Toshi Kani

When acpi_device_install_notify_handler() failed in acpi_device_probe(), it calls acpi_drv->ops.remove() and fails the probe. However, the ACPI driver is left bound to the acpi_device. Fix it by clearing the driver and driver_data fields.

---
This patch is based on linux-pm.git/bleeding-edge.

Good catch, thanks. I'm going to apply it.

Rafael

Quoted 17 lines
---
 drivers/acpi/scan.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/scan.c +2 -0
index d6caf1d..39659bb 100644
@@ -627,6 +627,8 @@ static int acpi_device_probe(struct device * dev)
 			if (ret) {
 				if (acpi_drv->ops.remove)
 					acpi_drv->ops.remove(acpi_dev);
+				acpi_dev->driver = NULL;
+				acpi_dev->driver_data = NULL;
 				return ret;
 			}
 		}
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
author
#2 lore raw
Quoted 11 lines · Rafael J. Wysocki
Quoted 8 lines · Toshi Kani

When acpi_device_install_notify_handler() failed in acpi_device_probe(), it calls acpi_drv->ops.remove() and fails the probe. However, the ACPI driver is left bound to the acpi_device. Fix it by clearing the driver and driver_data fields.

---
This patch is based on linux-pm.git/bleeding-edge.

Good catch, thanks. I'm going to apply it.

Great! Thanks,
-Toshi

Quoted 21 lines

Rafael

Quoted 17 lines
---
 drivers/acpi/scan.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/scan.c +2 -0
index d6caf1d..39659bb 100644
@@ -627,6 +627,8 @@ static int acpi_device_probe(struct device * dev)
 			if (ret) {
 				if (acpi_drv->ops.remove)
 					acpi_drv->ops.remove(acpi_dev);
+				acpi_dev->driver = NULL;
+				acpi_dev->driver_data = NULL;
 				return ret;
 			}
 		}