gpio: use devm_kzalloc
We can use devres API for allocating memory. No need of using kfree.
Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c
index 3beed6e..0de8c70 100644
--- a/drivers/gpio/gpio-adp5588.c
+++ b/drivers/gpio/gpio-adp5588.c
@@ -378,7 +378,7 @@
return -EIO;
}
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = devm_kzalloc(&client->dev, sizeof(*dev), GFP_KERNEL);
if (dev == NULL)
return -ENOMEM;
@@ -446,7 +446,6 @@
err_irq:
adp5588_irq_teardown(dev);
err:
- kfree(dev);
return ret;
}