diff mbox

ACPI: Unbind ACPI drv when probe failed

Message ID 1360271953-15643-1-git-send-email-toshi.kani@hp.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Toshi Kani Feb. 7, 2013, 9:19 p.m. UTC
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.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
---
This patch is based on linux-pm.git/bleeding-edge.
---
 drivers/acpi/scan.c |    2 ++
 1 file changed, 2 insertions(+)

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Toshi Kani Feb. 7, 2013, 10:12 p.m. UTC | #1
On Thu, 2013-02-07 at 23:18 +0100, Rafael J. Wysocki wrote:
> On Thursday, February 07, 2013 02:19:13 PM Toshi Kani wrote:
> > 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.
> > 
> > Signed-off-by: Toshi Kani <toshi.kani@hp.com>
> > ---
> > This patch is based on linux-pm.git/bleeding-edge.
> 
> Good catch, thanks.  I'm going to apply it.

Great!  Thanks,
-Toshi


> 
> Rafael
> 
> 
> > ---
> >  drivers/acpi/scan.c |    2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> > index d6caf1d..39659bb 100644
> > --- a/drivers/acpi/scan.c
> > +++ b/drivers/acpi/scan.c
> > @@ -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;
> >  			}
> >  		}


--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael Wysocki Feb. 7, 2013, 10:18 p.m. UTC | #2
On Thursday, February 07, 2013 02:19:13 PM Toshi Kani wrote:
> 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.
> 
> Signed-off-by: Toshi Kani <toshi.kani@hp.com>
> ---
> This patch is based on linux-pm.git/bleeding-edge.

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

Rafael


> ---
>  drivers/acpi/scan.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index d6caf1d..39659bb 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -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;
>  			}
>  		}
diff mbox

Patch

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index d6caf1d..39659bb 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -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;
 			}
 		}