All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pwm: sun4i: Initialize variables before use
@ 2020-01-20 14:32 Thierry Reding
  2020-01-20 20:09 ` Uwe Kleine-König
  0 siblings, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2020-01-20 14:32 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Uwe Kleine-König, Maxime Ripard, Jernej Skrabec,
	Clément Péron, linux-pwm

GCC can't always determine that the duty, period and prescaler values
are initialized when returning from sun4i_pwm_calculate(), so help out a
little by initializing them to 0.

Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
 drivers/pwm/pwm-sun4i.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
index 0decc7cde133..3e3efa6c768f 100644
--- a/drivers/pwm/pwm-sun4i.c
+++ b/drivers/pwm/pwm-sun4i.c
@@ -234,9 +234,9 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 {
 	struct sun4i_pwm_chip *sun4i_pwm = to_sun4i_pwm_chip(chip);
 	struct pwm_state cstate;
-	u32 ctrl, duty, period, val;
+	u32 ctrl, duty = 0, period = 0, val;
 	int ret;
-	unsigned int delay_us, prescaler;
+	unsigned int delay_us, prescaler = 0;
 	unsigned long now;
 	bool bypass;
 
-- 
2.24.1

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

end of thread, other threads:[~2020-01-21 14:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-20 14:32 [PATCH] pwm: sun4i: Initialize variables before use Thierry Reding
2020-01-20 20:09 ` Uwe Kleine-König
2020-01-20 20:23   ` Clément Péron
2020-01-21 13:50   ` Thierry Reding
2020-01-21 14:31     ` Uwe Kleine-König

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.