summaryrefslogtreecommitdiffstats
path: root/drivers/pwm
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@avionic-design.de>2012-07-11 08:05:05 +0200
committerThierry Reding <thierry.reding@avionic-design.de>2012-07-23 13:24:17 +0200
commitd295b129762bf6b2b7541243f496e363580de4a2 (patch)
treedb084cabcabf6924d940ee10b0398b4340ed90a7 /drivers/pwm
parent2132fa8d95bc13b8b0e307553b04ee3517762ebe (diff)
downloadlinux-d295b129762bf6b2b7541243f496e363580de4a2.tar.gz
linux-d295b129762bf6b2b7541243f496e363580de4a2.tar.bz2
linux-d295b129762bf6b2b7541243f496e363580de4a2.zip
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>
Diffstat (limited to 'drivers/pwm')
-rw-r--r--drivers/pwm/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index dbab53005da8..ecb76909e946 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -529,9 +529,9 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id)
struct pwm_device *pwm = ERR_PTR(-EPROBE_DEFER);
const char *dev_id = dev ? dev_name(dev): NULL;
struct pwm_chip *chip = NULL;
+ unsigned int index = 0;
unsigned int best = 0;
struct pwm_lookup *p;
- unsigned int index;
unsigned int match;
/* look up via DT first */