pwm: sun4i: Initialize variables before use
authorThierry Reding <thierry.reding@gmail.com>
Mon, 20 Jan 2020 14:22:37 +0000 (15:22 +0100)
committerThierry Reding <thierry.reding@gmail.com>
Mon, 20 Jan 2020 14:22:37 +0000 (15:22 +0100)
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

index 0decc7cde133cafcd3d33d2758ec87e793b51658..3e3efa6c768f7de61ee09ef5535298d961ad26c9 100644 (file)
@@ -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;