提交 198b618a 编写于 作者: G Giedrius Statkevičius 提交者: Darren Hart

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: NGiedrius Statkevičius <giedrius.statkevicius@gmail.com>
Signed-off-by: NDarren Hart <dvhart@linux.intel.com>
上级 4f62568c
......@@ -775,8 +775,10 @@ static int asus_read_brightness(struct backlight_device *bd)
rv = acpi_evaluate_integer(asus->handle, METHOD_BRIGHTNESS_GET,
NULL, &value);
if (ACPI_FAILURE(rv))
if (ACPI_FAILURE(rv)) {
pr_warn("Error reading brightness\n");
return 0;
}
return value;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册