All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] pwm: ep93xx: Fix read of uninitialized variable ret
@ 2021-06-29 17:22 Colin King
  0 siblings, 0 replies; only message in thread
From: Colin King @ 2021-06-29 17:22 UTC (permalink / raw
  To: Thierry Reding, Uwe Kleine-König, Lee Jones, linux-pwm
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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: f6ef94edf0f6 ("pwm: ep93xx: Unfold legacy callbacks into ep93xx_pwm_apply()")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/pwm/pwm-ep93xx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pwm/pwm-ep93xx.c b/drivers/pwm/pwm-ep93xx.c
index 70fa2957f9d3..8a3d781e6514 100644
--- a/drivers/pwm/pwm-ep93xx.c
+++ b/drivers/pwm/pwm-ep93xx.c
@@ -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;
 		}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-29 17:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-29 17:22 [PATCH][next] pwm: ep93xx: Fix read of uninitialized variable ret Colin King

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.