All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pwm: img: Turn final 'else if' into 'else' in img_pwm_config
@ 2019-03-07 22:36 Nathan Chancellor
  2019-03-08  0:23 ` Nick Desaulniers
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Nathan Chancellor @ 2019-03-07 22:36 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-pwm, linux-kernel, clang-built-linux, Nick Desaulniers,
	Nathan Chancellor

When building with -Wsometimes-uninitialized, Clang warns:

drivers/pwm/pwm-img.c:126:13: error: variable 'timebase' is used
uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]

The final else if functions as an else; make that explicit so that Clang
understands that timebase cannot be used uninitialized.

Link: https://github.com/ClangBuiltLinux/linux/issues/400
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/pwm/pwm-img.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c
index 815f5333bb8f..1cc5fbe1e1d3 100644
--- a/drivers/pwm/pwm-img.c
+++ b/drivers/pwm/pwm-img.c
@@ -123,7 +123,7 @@ static int img_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
 	} else if (mul <= max_timebase * 512) {
 		div = PWM_CTRL_CFG_SUB_DIV0_DIV1;
 		timebase = DIV_ROUND_UP(mul, 512);
-	} else if (mul > max_timebase * 512) {
+	} else {
 		dev_err(chip->dev,
 			"failed to configure timebase steps/divider value\n");
 		return -EINVAL;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-03-20 11:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 22:36 [PATCH] pwm: img: Turn final 'else if' into 'else' in img_pwm_config Nathan Chancellor
2019-03-08  0:23 ` Nick Desaulniers
2019-03-08  8:53 ` Uwe Kleine-König
2019-03-08 18:38   ` Nick Desaulniers
2019-03-08 21:18     ` Uwe Kleine-König
2019-03-08 21:23       ` Nick Desaulniers
2019-03-08 21:49         ` Uwe Kleine-König
2019-03-08  8:58 ` Uwe Kleine-König
2019-03-08 18:18   ` Nick Desaulniers
2019-03-20 11:30 ` Thierry Reding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.