Skip to content

Commit

Permalink
gpio: pcf857x: fixup smatch WARNING
Browse files Browse the repository at this point in the history
6e20a0a
(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>
  • Loading branch information
Kuninori Morimoto authored and Linus Walleij committed Sep 12, 2012
1 parent 20bc4d5 commit 3c05288
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpio/gpio-pcf857x.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ static int pcf857x_probe(struct i2c_client *client,
gpio->chip.ngpio = id->driver_data;

/* enable gpio_to_irq() if platform has settings */
if (pdata->irq) {
if (pdata && pdata->irq) {
status = pcf857x_irq_domain_init(gpio, pdata, &client->dev);
if (status < 0) {
dev_err(&client->dev, "irq_domain init failed\n");
Expand Down Expand Up @@ -394,7 +394,7 @@ static int pcf857x_probe(struct i2c_client *client,
dev_dbg(&client->dev, "probe error %d for '%s'\n",
status, client->name);

if (pdata->irq)
if (pdata && pdata->irq)
pcf857x_irq_domain_cleanup(gpio);

kfree(gpio);
Expand All @@ -418,7 +418,7 @@ static int pcf857x_remove(struct i2c_client *client)
}
}

if (pdata->irq)
if (pdata && pdata->irq)
pcf857x_irq_domain_cleanup(gpio);

status = gpiochip_remove(&gpio->chip);
Expand Down

0 comments on commit 3c05288

Please sign in to comment.