Skip to content

Commit

Permalink
ACPI / video: Fix using an uninitialized mutex / list_head in acpi_vi…
Browse files Browse the repository at this point in the history
…deo_handles_brightness_key_presses()

If acpi_video_handles_brightness_key_presses() was called before
acpi_video_register(), it would use the video_list mutex / list_head
uninitialized.

This patch fixes this by using DEFINE_MUTEX / LIST_HEAD when declaring
these, instead of initializing them runtime from acpi_video_register().

Fixes: 90b066b "ACPI / video: Add a acpi_video_handles_brightness_key_presses() helper"
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Hans de Goede authored and Rafael J. Wysocki committed Jan 15, 2016
1 parent 970530c commit 14e9355
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/acpi/acpi_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ module_param(only_lcd, bool, 0444);

static int register_count;
static DEFINE_MUTEX(register_count_mutex);
static struct mutex video_list_lock;
static struct list_head video_bus_head;
static DEFINE_MUTEX(video_list_lock);
static LIST_HEAD(video_bus_head);
static int acpi_video_bus_add(struct acpi_device *device);
static int acpi_video_bus_remove(struct acpi_device *device);
static void acpi_video_bus_notify(struct acpi_device *device, u32 event);
Expand Down Expand Up @@ -2067,9 +2067,6 @@ int acpi_video_register(void)
goto leave;
}

mutex_init(&video_list_lock);
INIT_LIST_HEAD(&video_bus_head);

dmi_check_system(video_dmi_table);

ret = acpi_bus_register_driver(&acpi_video_bus);
Expand Down

0 comments on commit 14e9355

Please sign in to comment.