Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9686f771 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Greg Kroah-Hartman
Browse files

leds: pwm: simplify if condition



[ Upstream commit b43a8f01fccbfdddbc7f9b2bbad11b7db3fda4e1 ]

.pwm_period_ns is an unsigned integer. So when led->pwm_period_ns > 0
is false, we now assign 0 to a value that is already 0, so it doesn't
hurt and we can skip checking the actual value.

Signed-off-by: default avatarUwe Kleine-König <uwe@kleine-koenig.org>
Tested-by: default avatarJeff LaBundy <jeff@labundy.com>
Signed-off-by: default avatarPavel Machek <pavel@ucw.cz>
Stable-dep-of: 76fe464c8e64 ("leds: pwm: Don't disable the PWM when the LED should be off")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 87b1ee83
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
	pwm_get_args(led_data->pwm, &pargs);

	led_data->period = pargs.period;
	if (!led_data->period && (led->pwm_period_ns > 0))
	if (!led_data->period)
		led_data->period = led->pwm_period_ns;

	ret = devm_led_classdev_register(dev, &led_data->cdev);