diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-04-04 07:19:16 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2012-06-01 13:41:40 -0400 |
commit | 301f33fbcf4ced53b3de114846ecece5d6aafeeb (patch) | |
tree | 2907366f7a1d5612e89a6579a5e7a57a92cfe348 /drivers/acpi/video.c | |
parent | 155689defc782b486a7e6776a57ecc4ebb37ed52 (diff) |
ACPI video: use after input_unregister_device()
We can't use "input" anymore after calling input_unregister_device().
The call to input_free_device() is a double free. The normal way to
deal with this is to make input_register_device() the last function
called in the function.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 609262dc1258..a576575617d7 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -1687,10 +1687,6 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1687 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); | 1687 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); |
1688 | set_bit(KEY_DISPLAY_OFF, input->keybit); | 1688 | set_bit(KEY_DISPLAY_OFF, input->keybit); |
1689 | 1689 | ||
1690 | error = input_register_device(input); | ||
1691 | if (error) | ||
1692 | goto err_stop_video; | ||
1693 | |||
1694 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", | 1690 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", |
1695 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), | 1691 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), |
1696 | video->flags.multihead ? "yes" : "no", | 1692 | video->flags.multihead ? "yes" : "no", |
@@ -1701,12 +1697,16 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1701 | video->pm_nb.priority = 0; | 1697 | video->pm_nb.priority = 0; |
1702 | error = register_pm_notifier(&video->pm_nb); | 1698 | error = register_pm_notifier(&video->pm_nb); |
1703 | if (error) | 1699 | if (error) |
1704 | goto err_unregister_input_dev; | 1700 | goto err_stop_video; |
1701 | |||
1702 | error = input_register_device(input); | ||
1703 | if (error) | ||
1704 | goto err_unregister_pm_notifier; | ||
1705 | 1705 | ||
1706 | return 0; | 1706 | return 0; |
1707 | 1707 | ||
1708 | err_unregister_input_dev: | 1708 | err_unregister_pm_notifier: |
1709 | input_unregister_device(input); | 1709 | unregister_pm_notifier(&video->pm_nb); |
1710 | err_stop_video: | 1710 | err_stop_video: |
1711 | acpi_video_bus_stop_devices(video); | 1711 | acpi_video_bus_stop_devices(video); |
1712 | err_free_input_dev: | 1712 | err_free_input_dev: |