diff options
Diffstat (limited to 'drivers/gpio/gpio-adp5588.c')
-rw-r--r-- | drivers/gpio/gpio-adp5588.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c index 3beed6ea8c65..d3fe6a6776da 100644 --- a/drivers/gpio/gpio-adp5588.c +++ b/drivers/gpio/gpio-adp5588.c @@ -367,7 +367,7 @@ static int adp5588_gpio_probe(struct i2c_client *client, struct gpio_chip *gc; int ret, i, revid; - if (pdata == NULL) { + if (!pdata) { dev_err(&client->dev, "missing platform data\n"); return -ENODEV; } @@ -378,8 +378,8 @@ static int adp5588_gpio_probe(struct i2c_client *client, return -EIO; } - dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (dev == NULL) + dev = devm_kzalloc(&client->dev, sizeof(*dev), GFP_KERNEL); + if (!dev) return -ENOMEM; dev->client = client; @@ -446,7 +446,6 @@ static int adp5588_gpio_probe(struct i2c_client *client, err_irq: adp5588_irq_teardown(dev); err: - kfree(dev); return ret; } @@ -472,7 +471,6 @@ static int adp5588_gpio_remove(struct i2c_client *client) gpiochip_remove(&dev->gpio_chip); - kfree(dev); return 0; } |