Skip to contentSkip to conversation

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

PATCH Applied [email protected] 2 participants 2 messages Aug 6, 2009 – Aug 27, 2009 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 6/9 acpi: don't free non-existent backlight in acpi video module

From: Keith Packard <[email protected]>

acpi_video_put_one_device was attempting to remove sysfs entries and unregister a backlight device without first checking that said backlight device structure had been created.

---

 drivers/acpi/video.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/acpi/video.c renamed from drivers/acpi/video.c~acpi-dont-free-non-existent-backlight-in-acpi-video-module +5 -2
diff -puN drivers/acpi/video.c~acpi-dont-free-non-existent-backlight-in-acpi-video-module drivers/acpi/video.c
@@ -2004,8 +2004,11 @@ static int acpi_video_bus_put_one_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);
+		device->backlight = NULL;
+	}
 	if (device->cdev) {
 		sysfs_remove_link(&device->dev->dev.kobj,
 				  "thermal_cooling");

_

reviewer
#1 lore raw

Applied for 2.6.31

thanks,
Len Brown, Intel Open Source Technology Center

Quoted 34 lines · On Thu, 6 Aug 2009, [email protected] wrote:

From: Keith Packard <[email protected]>

acpi_video_put_one_device was attempting to remove sysfs entries and unregister a backlight device without first checking that said backlight device structure had been created.

---

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

diff -puN drivers/acpi/video.c~acpi-dont-free-non-existent-backlight-in-acpi-video-module drivers/acpi/video.c

drivers/acpi/video.c renamed from drivers/acpi/video.c~acpi-dont-free-non-existent-backlight-in-acpi-video-module +5 -2
@@ -2004,8 +2004,11 @@ static int acpi_video_bus_put_one_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);
+		device->backlight = NULL;
+	}
 	if (device->cdev) {
 		sysfs_remove_link(&device->dev->dev.kobj,
 				  "thermal_cooling");

_