diff options
author | Giedrius Statkevičius <giedrius.statkevicius@gmail.com> | 2016-04-15 20:27:12 -0400 |
---|---|---|
committer | Darren Hart <dvhart@linux.intel.com> | 2016-04-25 13:39:58 -0400 |
commit | 198b618ab118c7d856278a985de1ed0eff77c02f (patch) | |
tree | 4bd46856f0ce8791ca9c8b55d929ab09a7de21ac /drivers/platform | |
parent | 4f62568c1fcf0f7da49e7c22bdd01645aa508e80 (diff) |
asus-laptop: correct error handling in asus_read_brightness()
It is possible that acpi_evaluate_integer might fail and value would not be
set to any value so correct this defect by returning 0 in case of an
error. This is also the correct thing to return because the backlight
subsystem will print the old value of brightness in this case.
Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/asus-laptop.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index f2b5d0a8adf0..a4cd78691ac9 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c | |||
@@ -775,8 +775,10 @@ static int asus_read_brightness(struct backlight_device *bd) | |||
775 | 775 | ||
776 | rv = acpi_evaluate_integer(asus->handle, METHOD_BRIGHTNESS_GET, | 776 | rv = acpi_evaluate_integer(asus->handle, METHOD_BRIGHTNESS_GET, |
777 | NULL, &value); | 777 | NULL, &value); |
778 | if (ACPI_FAILURE(rv)) | 778 | if (ACPI_FAILURE(rv)) { |
779 | pr_warn("Error reading brightness\n"); | 779 | pr_warn("Error reading brightness\n"); |
780 | return 0; | ||
781 | } | ||
780 | 782 | ||
781 | return value; | 783 | return value; |
782 | } | 784 | } |