Skip to content

Commit

Permalink
pwm: ep93xx: Fix read of uninitialized variable ret
Browse files Browse the repository at this point in the history
There is a potential path in function ep93xx_pwm_apply where ret is
never assigned a value and it is checked for an error code. Fix this
by ensuring ret is zero'd in the success path to avoid this issue.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: f6ef94e ("pwm: ep93xx: Unfold legacy callbacks into ep93xx_pwm_apply()")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
  • Loading branch information
Colin Ian King authored and Thierry Reding committed Jun 30, 2021
1 parent b235f8a commit 96e45e5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/pwm/pwm-ep93xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ static int ep93xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
writew(duty_cycles, base + EP93XX_PWMx_DUTY_CYCLE);
writew(period_cycles, base + EP93XX_PWMx_TERM_COUNT);
}
ret = 0;
} else {
ret = -EINVAL;
}
Expand Down

0 comments on commit 96e45e5

Please sign in to comment.