There is neither need to have an additional assignment of ret, nor the non-so-standard conditional. Moreover, the resulting code better to read and less LOCs. Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> --- drivers/leds/led-core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c index f1f718dbe0f8..810053fbe0f6 100644 --- a/drivers/leds/led-core.c +++ b/drivers/leds/led-core.c @@ -308,17 +308,16 @@ EXPORT_SYMBOL_GPL(led_set_brightness_sync); int led_update_brightness(struct led_classdev *led_cdev) { - int ret = 0; + int ret; if (led_cdev->brightness_get) { ret = led_cdev->brightness_get(led_cdev); - if (ret >= 0) { - led_cdev->brightness = ret; - return 0; - } + if (ret < 0) + return ret; } - return ret; + led_cdev->brightness = ret; + return 0; } EXPORT_SYMBOL_GPL(led_update_brightness); -- 2.23.0.rc1