diff options
Diffstat (limited to 'drivers/acpi/video.c')
| -rw-r--r-- | drivers/acpi/video.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index bd4887518373..e7e9a693953a 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -323,7 +323,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, | |||
| 323 | if (!ACPI_SUCCESS(status)) | 323 | if (!ACPI_SUCCESS(status)) |
| 324 | return_VALUE(status); | 324 | return_VALUE(status); |
| 325 | obj = (union acpi_object *)buffer.pointer; | 325 | obj = (union acpi_object *)buffer.pointer; |
| 326 | if (!obj && (obj->type != ACPI_TYPE_PACKAGE)) { | 326 | if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { |
| 327 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); | 327 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); |
| 328 | status = -EFAULT; | 328 | status = -EFAULT; |
| 329 | goto err; | 329 | goto err; |
| @@ -1294,7 +1294,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
| 1294 | struct acpi_video_bus *video) | 1294 | struct acpi_video_bus *video) |
| 1295 | { | 1295 | { |
| 1296 | unsigned long device_id; | 1296 | unsigned long device_id; |
| 1297 | int status, result; | 1297 | int status; |
| 1298 | struct acpi_video_device *data; | 1298 | struct acpi_video_device *data; |
| 1299 | 1299 | ||
| 1300 | ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device"); | 1300 | ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device"); |
| @@ -1346,8 +1346,11 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
| 1346 | if (ACPI_FAILURE(status)) { | 1346 | if (ACPI_FAILURE(status)) { |
| 1347 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1347 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 1348 | "Error installing notify handler\n")); | 1348 | "Error installing notify handler\n")); |
| 1349 | result = -ENODEV; | 1349 | if(data->brightness) |
| 1350 | goto end; | 1350 | kfree(data->brightness->levels); |
| 1351 | kfree(data->brightness); | ||
| 1352 | kfree(data); | ||
| 1353 | return -ENODEV; | ||
| 1351 | } | 1354 | } |
| 1352 | 1355 | ||
| 1353 | down(&video->sem); | 1356 | down(&video->sem); |
| @@ -1359,7 +1362,6 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
| 1359 | return_VALUE(0); | 1362 | return_VALUE(0); |
| 1360 | } | 1363 | } |
| 1361 | 1364 | ||
| 1362 | end: | ||
| 1363 | return_VALUE(-ENOENT); | 1365 | return_VALUE(-ENOENT); |
| 1364 | } | 1366 | } |
| 1365 | 1367 | ||
| @@ -1643,8 +1645,9 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video) | |||
| 1643 | printk(KERN_WARNING PREFIX | 1645 | printk(KERN_WARNING PREFIX |
| 1644 | "hhuuhhuu bug in acpi video driver.\n"); | 1646 | "hhuuhhuu bug in acpi video driver.\n"); |
| 1645 | 1647 | ||
| 1648 | if (data->brightness) | ||
| 1649 | kfree(data->brightness->levels); | ||
| 1646 | kfree(data->brightness); | 1650 | kfree(data->brightness); |
| 1647 | |||
| 1648 | kfree(data); | 1651 | kfree(data); |
| 1649 | } | 1652 | } |
| 1650 | 1653 | ||
| @@ -1785,6 +1788,10 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
| 1785 | if (ACPI_FAILURE(status)) { | 1788 | if (ACPI_FAILURE(status)) { |
| 1786 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1789 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 1787 | "Error installing notify handler\n")); | 1790 | "Error installing notify handler\n")); |
| 1791 | acpi_video_bus_stop_devices(video); | ||
| 1792 | acpi_video_bus_put_devices(video); | ||
| 1793 | kfree(video->attached_array); | ||
| 1794 | acpi_video_bus_remove_fs(device); | ||
| 1788 | result = -ENODEV; | 1795 | result = -ENODEV; |
| 1789 | goto end; | 1796 | goto end; |
| 1790 | } | 1797 | } |
| @@ -1796,10 +1803,8 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
| 1796 | video->flags.post ? "yes" : "no"); | 1803 | video->flags.post ? "yes" : "no"); |
| 1797 | 1804 | ||
| 1798 | end: | 1805 | end: |
| 1799 | if (result) { | 1806 | if (result) |
| 1800 | acpi_video_bus_remove_fs(device); | ||
| 1801 | kfree(video); | 1807 | kfree(video); |
| 1802 | } | ||
| 1803 | 1808 | ||
| 1804 | return_VALUE(result); | 1809 | return_VALUE(result); |
| 1805 | } | 1810 | } |
