diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2012-09-12 01:19:47 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-09-12 11:45:01 -0400 |
commit | 3c0528810c18213a4d820da74557ba89339cb6ed (patch) | |
tree | 9c5ae912c7d6fc82484d5bbb0731adf4b3b32d0a /drivers/gpio | |
parent | 20bc4d5d565159eb2b942bf4b7fae86fba94e32c (diff) |
gpio: pcf857x: fixup smatch WARNING
6e20a0a429bd4dc07d6de16d9c247270e04e4aa0
(gpio: pcf857x: enable gpio_to_irq() support)
added new smatch warnings
drivers/gpio/gpio-pcf857x.c:288 pcf857x_probe() error: we previously \
assumed 'pdata' could be null (see line 277)
drivers/gpio/gpio-pcf857x.c:364 pcf857x_probe() warn: variable dereferenced\
before check 'pdata' (see line 292)
drivers/gpio/gpio-pcf857x.c:421 pcf857x_remove() error: we previously\
assumed 'pdata' could be null (see line 410)
This patch fixes it
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-pcf857x.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c index 12e3e484d70b..16af35cd2b10 100644 --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c | |||
@@ -285,7 +285,7 @@ static int pcf857x_probe(struct i2c_client *client, | |||
285 | gpio->chip.ngpio = id->driver_data; | 285 | gpio->chip.ngpio = id->driver_data; |
286 | 286 | ||
287 | /* enable gpio_to_irq() if platform has settings */ | 287 | /* enable gpio_to_irq() if platform has settings */ |
288 | if (pdata->irq) { | 288 | if (pdata && pdata->irq) { |
289 | status = pcf857x_irq_domain_init(gpio, pdata, &client->dev); | 289 | status = pcf857x_irq_domain_init(gpio, pdata, &client->dev); |
290 | if (status < 0) { | 290 | if (status < 0) { |
291 | dev_err(&client->dev, "irq_domain init failed\n"); | 291 | dev_err(&client->dev, "irq_domain init failed\n"); |
@@ -394,7 +394,7 @@ fail: | |||
394 | dev_dbg(&client->dev, "probe error %d for '%s'\n", | 394 | dev_dbg(&client->dev, "probe error %d for '%s'\n", |
395 | status, client->name); | 395 | status, client->name); |
396 | 396 | ||
397 | if (pdata->irq) | 397 | if (pdata && pdata->irq) |
398 | pcf857x_irq_domain_cleanup(gpio); | 398 | pcf857x_irq_domain_cleanup(gpio); |
399 | 399 | ||
400 | kfree(gpio); | 400 | kfree(gpio); |
@@ -418,7 +418,7 @@ static int pcf857x_remove(struct i2c_client *client) | |||
418 | } | 418 | } |
419 | } | 419 | } |
420 | 420 | ||
421 | if (pdata->irq) | 421 | if (pdata && pdata->irq) |
422 | pcf857x_irq_domain_cleanup(gpio); | 422 | pcf857x_irq_domain_cleanup(gpio); |
423 | 423 | ||
424 | status = gpiochip_remove(&gpio->chip); | 424 | status = gpiochip_remove(&gpio->chip); |