[gpio] gpio: removing kfree remove functionality
diff mbox

Message ID 1428422680-4509-1-git-send-email-varkab@cdac.in
State New
Headers show

Commit Message

Varka Bhadram April 7, 2015, 4:04 p.m. UTC
commit 3de07e5aaf290a0b58919 ("drivers: gpio: use devm_kzalloc")
introduce devm_kzalloc() for allocating the memory. In this case kfree
is not required to use. Above commit id introduced the bug that kfree
is not removed from the remove function.

This patch fix the above bug.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
 drivers/gpio/gpio-adp5588.c  |    1 -
 drivers/gpio/gpio-mcp23s08.c |    2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

Comments

Linus Walleij April 8, 2015, 2:54 p.m. UTC | #1
On Tue, Apr 7, 2015 at 6:04 PM, Varka Bhadram <varkabhadram@gmail.com> wrote:

> commit 3de07e5aaf290a0b58919 ("drivers: gpio: use devm_kzalloc")
> introduce devm_kzalloc() for allocating the memory. In this case kfree
> is not required to use. Above commit id introduced the bug that kfree
> is not removed from the remove function.
>
> This patch fix the above bug.
>
> Signed-off-by: Varka Bhadram <varkab@cdac.in>

Patch applied.

BTW these "deep cleanups" are much appreciated.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c
index c90273d..d3fe6a6 100644
--- a/drivers/gpio/gpio-adp5588.c
+++ b/drivers/gpio/gpio-adp5588.c
@@ -471,7 +471,6 @@  static int adp5588_gpio_remove(struct i2c_client *client)
 
 	gpiochip_remove(&dev->gpio_chip);
 
-	kfree(dev);
 	return 0;
 }
 
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index a17b81f..2fc7ff8 100644
--- a/drivers/gpio/gpio-mcp23s08.c
+++ b/drivers/gpio/gpio-mcp23s08.c
@@ -1008,7 +1008,7 @@  static int mcp23s08_remove(struct spi_device *spi)
 			mcp23s08_irq_teardown(data->mcp[addr]);
 		gpiochip_remove(&data->mcp[addr]->chip);
 	}
-	kfree(data);
+
 	return 0;
 }