lkml.org 
[lkml]   [2017]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH v2 6/9] ACPI-video: Improve a jump target in acpi_video_switch_brightness()
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 9 Aug 2017 15:45:35 +0200

* Avoid another duplicate check for the local variable "result"
then at the end.

* Jump directly to an error message in the case that the desired brightness
can not be switched.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/acpi/acpi_video.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 8295ae1deab9..e279ed221961 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -1411,19 +1411,19 @@ acpi_video_switch_brightness(struct work_struct *work)
return;

if (!device->brightness)
- goto out;
+ goto report_failure;

result = acpi_video_device_lcd_get_level_current(device,
&level_current,
false);
if (result)
- goto out;
+ goto report_failure;

level_next = acpi_video_get_next_level(device, level_current, event);

result = acpi_video_device_lcd_set_level(device, level_next);
-out:
if (result)
+ report_failure:
printk(KERN_ERR PREFIX "Failed to switch the brightness\n");
else
backlight_force_update(device->backlight,
--
2.13.4
\
 
 \ /
  Last update: 2017-08-09 17:43    [W:0.799 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site