diff mbox

[1/4] ACPI: video - fix oops when unloading module

Message ID 20090808075631.77F4F526EC9@mailhub.coreip.homeip.net (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Dmitry Torokhov Aug. 8, 2009, 7:26 a.m. UTC
Don't assume that backlight is always present.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 drivers/acpi/video.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)


--
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

Zhang, Rui Aug. 10, 2009, 1:31 a.m. UTC | #1
On Sat, 2009-08-08 at 15:26 +0800, Dmitry Torokhov wrote:
> Don't assume that backlight is always present.
> 
Patch is already available.
http://patchwork.kernel.org/patch/39704/

thanks,
rui

> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
> ---
> 
>  drivers/acpi/video.c |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
> index 8851315..d8e64cf 100644
> --- a/drivers/acpi/video.c
> +++ b/drivers/acpi/video.c
> @@ -2004,8 +2004,12 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
>  	status = acpi_remove_notify_handler(device->dev->handle,
>  					    ACPI_DEVICE_NOTIFY,
>  					    acpi_video_device_notify);
> -	sysfs_remove_link(&device->backlight->dev.kobj, "device");
> -	backlight_device_unregister(device->backlight);
> +
> +	if (device->backlight) {
> +		sysfs_remove_link(&device->backlight->dev.kobj, "device");
> +		backlight_device_unregister(device->backlight);
> +	}
> +
>  	if (device->cdev) {
>  		sysfs_remove_link(&device->dev->dev.kobj,
>  				  "thermal_cooling");
> @@ -2014,6 +2018,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
>  		thermal_cooling_device_unregister(device->cdev);
>  		device->cdev = NULL;
>  	}
> +
>  	video_output_unregister(device->output_dev);
>  
>  	return 0;
> 

--
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
Len Brown Aug. 30, 2009, 2:55 a.m. UTC | #2
On Mon, 10 Aug 2009, Zhang Rui wrote:

> On Sat, 2009-08-08 at 15:26 +0800, Dmitry Torokhov wrote:
> > Don't assume that backlight is always present.
> > 
> Patch is already available.
> http://patchwork.kernel.org/patch/39704/

it is upstream now:


commit e29b3ee3b005897fbdcfdd4b3190776e38739d70
Author: Keith Packard <keithp@keithp.com>
Date:   Thu Aug 6 15:57:54 2009 -0700

    ACPI: don't free non-existent backlight in acpi video module

--
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
diff mbox

Patch

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 8851315..d8e64cf 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -2004,8 +2004,12 @@  static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
 	status = acpi_remove_notify_handler(device->dev->handle,
 					    ACPI_DEVICE_NOTIFY,
 					    acpi_video_device_notify);
-	sysfs_remove_link(&device->backlight->dev.kobj, "device");
-	backlight_device_unregister(device->backlight);
+
+	if (device->backlight) {
+		sysfs_remove_link(&device->backlight->dev.kobj, "device");
+		backlight_device_unregister(device->backlight);
+	}
+
 	if (device->cdev) {
 		sysfs_remove_link(&device->dev->dev.kobj,
 				  "thermal_cooling");
@@ -2014,6 +2018,7 @@  static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
 		thermal_cooling_device_unregister(device->cdev);
 		device->cdev = NULL;
 	}
+
 	video_output_unregister(device->output_dev);
 
 	return 0;