Commit d295b129762bf6b2b7541243f496e363580de4a2

Authored by Thierry Reding
1 parent 2132fa8d95

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 <swarren@nvidia.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -529,9 +529,9 @@
529 529 struct pwm_device *pwm = ERR_PTR(-EPROBE_DEFER);
530 530 const char *dev_id = dev ? dev_name(dev): NULL;
531 531 struct pwm_chip *chip = NULL;
  532 + unsigned int index = 0;
532 533 unsigned int best = 0;
533 534 struct pwm_lookup *p;
534   - unsigned int index;
535 535 unsigned int match;
536 536  
537 537 /* look up via DT first */