Skip to content

Commit 413c2a1

Browse files
committed
pwm: sun4i: Initialize variables before use
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 <[email protected]>
1 parent 0c73201 commit 413c2a1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/pwm/pwm-sun4i.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
234234
{
235235
struct sun4i_pwm_chip *sun4i_pwm = to_sun4i_pwm_chip(chip);
236236
struct pwm_state cstate;
237-
u32 ctrl, duty, period, val;
237+
u32 ctrl, duty = 0, period = 0, val;
238238
int ret;
239-
unsigned int delay_us, prescaler;
239+
unsigned int delay_us, prescaler = 0;
240240
unsigned long now;
241241
bool bypass;
242242

0 commit comments

Comments
 (0)