Skip to content

Commit

Permalink
pwm: img: Turn final 'else if' into 'else' in img_pwm_config
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
  • Loading branch information
Nathan Chancellor authored and Thierry Reding committed Mar 20, 2019
1 parent 347ab94 commit 4448195
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pwm/pwm-img.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4448195

Please sign in to comment.