Skip to content

Commit d295b12

Browse files
author
Thierry Reding
committed
pwm: fix used-uninitialized warning in pwm_get()
Some versions of GCC don't seem no notice that the initialization of the index variable is tied to that of the chip variable and falsely report it as potentially being used uninitialized. However, to save anybody else from tripping over this, we now initialize the index variable unconditionally. Originally-by: Stephen Warren <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 2132fa8 commit d295b12

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pwm/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,9 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id)
529529
struct pwm_device *pwm = ERR_PTR(-EPROBE_DEFER);
530530
const char *dev_id = dev ? dev_name(dev): NULL;
531531
struct pwm_chip *chip = NULL;
532+
unsigned int index = 0;
532533
unsigned int best = 0;
533534
struct pwm_lookup *p;
534-
unsigned int index;
535535
unsigned int match;
536536

537537
/* look up via DT first */

0 commit comments

Comments
 (0)