Commit e29b3ee3 authored by Keith Packard's avatar Keith Packard Committed by Len Brown

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

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.
Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
Acked-by: default avatarZhang Rui <rui.zhang@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 82e7784f
...@@ -2004,8 +2004,11 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) ...@@ -2004,8 +2004,11 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
status = acpi_remove_notify_handler(device->dev->handle, status = acpi_remove_notify_handler(device->dev->handle,
ACPI_DEVICE_NOTIFY, ACPI_DEVICE_NOTIFY,
acpi_video_device_notify); acpi_video_device_notify);
sysfs_remove_link(&device->backlight->dev.kobj, "device"); if (device->backlight) {
backlight_device_unregister(device->backlight); sysfs_remove_link(&device->backlight->dev.kobj, "device");
backlight_device_unregister(device->backlight);
device->backlight = NULL;
}
if (device->cdev) { if (device->cdev) {
sysfs_remove_link(&device->dev->dev.kobj, sysfs_remove_link(&device->dev->dev.kobj,
"thermal_cooling"); "thermal_cooling");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment