* [PATCH 2/6] gpio: max7300: use devm_kzalloc()
2013-03-15 9:14 [PATCH 1/6] gpio: adp5520: use devm_kzalloc() Jingoo Han
@ 2013-03-15 9:14 ` Jingoo Han
2013-03-27 8:47 ` Linus Walleij
2013-03-15 9:15 ` [PATCH 3/6] gpio: max7301: " Jingoo Han
` (4 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Jingoo Han @ 2013-03-15 9:14 UTC (permalink / raw)
To: 'Grant Likely'
Cc: 'Linus Walleij', linux-kernel, 'Jingoo Han'
Use devm_kzalloc() to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/gpio/gpio-max7300.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpio-max7300.c b/drivers/gpio/gpio-max7300.c
index 4b6b9a0..40ab6df 100644
--- a/drivers/gpio/gpio-max7300.c
+++ b/drivers/gpio/gpio-max7300.c
@@ -41,7 +41,7 @@ static int max7300_probe(struct i2c_client *client,
I2C_FUNC_SMBUS_BYTE_DATA))
return -EIO;
- ts = kzalloc(sizeof(struct max7301), GFP_KERNEL);
+ ts = devm_kzalloc(&client->dev, sizeof(struct max7301), GFP_KERNEL);
if (!ts)
return -ENOMEM;
@@ -50,8 +50,6 @@ static int max7300_probe(struct i2c_client *client,
ts->dev = &client->dev;
ret = __max730x_probe(ts);
- if (ret)
- kfree(ts);
return ret;
}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/6] gpio: max7301: use devm_kzalloc()
2013-03-15 9:14 [PATCH 1/6] gpio: adp5520: use devm_kzalloc() Jingoo Han
2013-03-15 9:14 ` [PATCH 2/6] gpio: max7300: " Jingoo Han
@ 2013-03-15 9:15 ` Jingoo Han
2013-03-27 8:48 ` Linus Walleij
2013-03-15 9:15 ` [PATCH 4/6] gpio: max732x: " Jingoo Han
` (3 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Jingoo Han @ 2013-03-15 9:15 UTC (permalink / raw)
To: 'Grant Likely'
Cc: 'Linus Walleij', linux-kernel, 'Jingoo Han'
Use devm_kzalloc() to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/gpio/gpio-max7301.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpio-max7301.c b/drivers/gpio/gpio-max7301.c
index c6c535c..6e1c984 100644
--- a/drivers/gpio/gpio-max7301.c
+++ b/drivers/gpio/gpio-max7301.c
@@ -61,7 +61,7 @@ static int max7301_probe(struct spi_device *spi)
if (ret < 0)
return ret;
- ts = kzalloc(sizeof(struct max7301), GFP_KERNEL);
+ ts = devm_kzalloc(&spi->dev, sizeof(struct max7301), GFP_KERNEL);
if (!ts)
return -ENOMEM;
@@ -70,8 +70,6 @@ static int max7301_probe(struct spi_device *spi)
ts->dev = &spi->dev;
ret = __max730x_probe(ts);
- if (ret)
- kfree(ts);
return ret;
}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/6] gpio: max732x: use devm_kzalloc()
2013-03-15 9:14 [PATCH 1/6] gpio: adp5520: use devm_kzalloc() Jingoo Han
2013-03-15 9:14 ` [PATCH 2/6] gpio: max7300: " Jingoo Han
2013-03-15 9:15 ` [PATCH 3/6] gpio: max7301: " Jingoo Han
@ 2013-03-15 9:15 ` Jingoo Han
2013-03-27 8:49 ` Linus Walleij
2013-03-15 9:15 ` [PATCH 5/6] gpio: mc33880: " Jingoo Han
` (2 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Jingoo Han @ 2013-03-15 9:15 UTC (permalink / raw)
To: 'Grant Likely'
Cc: 'Linus Walleij', linux-kernel, 'Jingoo Han'
Use devm_kzalloc() to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/gpio/gpio-max732x.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index 1e0467c..d4b51b1 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -589,7 +589,8 @@ static int max732x_probe(struct i2c_client *client,
return -EINVAL;
}
- chip = kzalloc(sizeof(struct max732x_chip), GFP_KERNEL);
+ chip = devm_kzalloc(&client->dev, sizeof(struct max732x_chip),
+ GFP_KERNEL);
if (chip == NULL)
return -ENOMEM;
chip->client = client;
@@ -647,7 +648,6 @@ static int max732x_probe(struct i2c_client *client,
out_failed:
max732x_irq_teardown(chip);
- kfree(chip);
return ret;
}
@@ -680,7 +680,6 @@ static int max732x_remove(struct i2c_client *client)
if (chip->client_dummy)
i2c_unregister_device(chip->client_dummy);
- kfree(chip);
return 0;
}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/6] gpio: mc33880: use devm_kzalloc()
2013-03-15 9:14 [PATCH 1/6] gpio: adp5520: use devm_kzalloc() Jingoo Han
` (2 preceding siblings ...)
2013-03-15 9:15 ` [PATCH 4/6] gpio: max732x: " Jingoo Han
@ 2013-03-15 9:15 ` Jingoo Han
2013-03-27 8:50 ` Linus Walleij
2013-03-15 9:16 ` [PATCH 6/6] gpio: pcf857x: " Jingoo Han
2013-03-27 8:46 ` [PATCH 1/6] gpio: adp5520: " Linus Walleij
5 siblings, 1 reply; 12+ messages in thread
From: Jingoo Han @ 2013-03-15 9:15 UTC (permalink / raw)
To: 'Grant Likely'
Cc: 'Linus Walleij', linux-kernel, 'Jingoo Han'
Use devm_kzalloc() to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/gpio/gpio-mc33880.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-mc33880.c b/drivers/gpio/gpio-mc33880.c
index 6a8fdc2..b161489 100644
--- a/drivers/gpio/gpio-mc33880.c
+++ b/drivers/gpio/gpio-mc33880.c
@@ -101,7 +101,7 @@ static int mc33880_probe(struct spi_device *spi)
if (ret < 0)
return ret;
- mc = kzalloc(sizeof(struct mc33880), GFP_KERNEL);
+ mc = devm_kzalloc(&spi->dev, sizeof(struct mc33880), GFP_KERNEL);
if (!mc)
return -ENOMEM;
@@ -143,7 +143,6 @@ static int mc33880_probe(struct spi_device *spi)
exit_destroy:
dev_set_drvdata(&spi->dev, NULL);
mutex_destroy(&mc->lock);
- kfree(mc);
return ret;
}
@@ -159,10 +158,9 @@ static int mc33880_remove(struct spi_device *spi)
dev_set_drvdata(&spi->dev, NULL);
ret = gpiochip_remove(&mc->chip);
- if (!ret) {
+ if (!ret)
mutex_destroy(&mc->lock);
- kfree(mc);
- } else
+ else
dev_err(&spi->dev, "Failed to remove the GPIO controller: %d\n",
ret);
--
1.7.2.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 6/6] gpio: pcf857x: use devm_kzalloc()
2013-03-15 9:14 [PATCH 1/6] gpio: adp5520: use devm_kzalloc() Jingoo Han
` (3 preceding siblings ...)
2013-03-15 9:15 ` [PATCH 5/6] gpio: mc33880: " Jingoo Han
@ 2013-03-15 9:16 ` Jingoo Han
2013-03-27 8:52 ` Linus Walleij
2013-03-27 8:46 ` [PATCH 1/6] gpio: adp5520: " Linus Walleij
5 siblings, 1 reply; 12+ messages in thread
From: Jingoo Han @ 2013-03-15 9:16 UTC (permalink / raw)
To: 'Grant Likely'
Cc: 'Linus Walleij', linux-kernel, 'Jingoo Han'
Use devm_kzalloc() to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/gpio/gpio-pcf857x.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c
index a19b745..4f76514 100644
--- a/drivers/gpio/gpio-pcf857x.c
+++ b/drivers/gpio/gpio-pcf857x.c
@@ -267,7 +267,7 @@ static int pcf857x_probe(struct i2c_client *client,
}
/* Allocate, initialize, and register this gpio_chip. */
- gpio = kzalloc(sizeof *gpio, GFP_KERNEL);
+ gpio = devm_kzalloc(&client->dev, sizeof(*gpio), GFP_KERNEL);
if (!gpio)
return -ENOMEM;
@@ -390,7 +390,6 @@ fail:
if (pdata && client->irq)
pcf857x_irq_domain_cleanup(gpio);
- kfree(gpio);
return status;
}
@@ -415,9 +414,7 @@ static int pcf857x_remove(struct i2c_client *client)
pcf857x_irq_domain_cleanup(gpio);
status = gpiochip_remove(&gpio->chip);
- if (status == 0)
- kfree(gpio);
- else
+ if (status)
dev_err(&client->dev, "%s --> %d\n", "remove", status);
return status;
}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/6] gpio: adp5520: use devm_kzalloc()
2013-03-15 9:14 [PATCH 1/6] gpio: adp5520: use devm_kzalloc() Jingoo Han
` (4 preceding siblings ...)
2013-03-15 9:16 ` [PATCH 6/6] gpio: pcf857x: " Jingoo Han
@ 2013-03-27 8:46 ` Linus Walleij
5 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2013-03-27 8:46 UTC (permalink / raw)
To: Jingoo Han; +Cc: Grant Likely, linux-kernel
On Fri, Mar 15, 2013 at 10:14 AM, Jingoo Han <jg1.han@samsung.com> wrote:
> Use devm_kzalloc() to make cleanup paths simpler.
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Patch applied.
Thanks!
Linus Walleij
^ permalink raw reply [flat|nested] 12+ messages in thread