ACK: [PATCH] acpi: brightness: check get_setting return

Alex Hung alex.hung at canonical.com
Thu May 9 05:53:51 UTC 2013


On 05/07/2013 05:31 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Coverity CID #997319: Unchecked return value (CHECKED_RETURN)
>
> We should really check the get_setting() return to see if it failed
> rather than blindly assuming it worked OK.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/acpi/brightness/brightness.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/acpi/brightness/brightness.c b/src/acpi/brightness/brightness.c
> index f523cbf..b4b588e 100644
> --- a/src/acpi/brightness/brightness.c
> +++ b/src/acpi/brightness/brightness.c
> @@ -158,7 +158,11 @@ static int brightness_test2(fwts_framework *fw)
>
>   					for (i=0;i<=max_brightness;i++) {
>   						set_setting(entry->d_name, "brightness", i);
> -						get_setting(entry->d_name, "actual_brightness", &actual_brightness);
> +						if (get_setting(entry->d_name, "actual_brightness", &actual_brightness) != FWTS_OK) {
> +							fwts_log_info(fw, "Cannot get brightness setting %d for backlight %s.", i, entry->d_name);
> +							failed++;
> +							continue;
> +						}
>   						if (actual_brightness != i)  {
>   							fwts_log_info(fw, "Actual brightness %d does not match the brightnesss level %d just set for backlight %s.", actual_brightness, i, entry->d_name);
>   							failed++;
>
Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list