* [PATCH] gpio: mvebu: Don't free chip label memory
@ 2013-01-14 10:53 Thierry Reding
2013-01-14 14:15 ` Grant Likely
0 siblings, 1 reply; 3+ messages in thread
From: Thierry Reding @ 2013-01-14 10:53 UTC (permalink / raw)
To: Grant Likely; +Cc: Linus Walleij, linux-kernel
The gpio_chip.label field is a const char * and assigned the value of a
call to dev_name(). Memory obtained from dev_name() should not be freed
by drivers.
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
---
drivers/gpio/gpio-mvebu.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 7d9bd94..6819d63 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -547,7 +547,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
mvchip->membase = devm_request_and_ioremap(&pdev->dev, res);
if (! mvchip->membase) {
dev_err(&pdev->dev, "Cannot ioremap\n");
- kfree(mvchip->chip.label);
return -ENOMEM;
}
@@ -557,14 +556,12 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (! res) {
dev_err(&pdev->dev, "Cannot get memory resource\n");
- kfree(mvchip->chip.label);
return -ENODEV;
}
mvchip->percpu_membase = devm_request_and_ioremap(&pdev->dev, res);
if (! mvchip->percpu_membase) {
dev_err(&pdev->dev, "Cannot ioremap\n");
- kfree(mvchip->chip.label);
return -ENOMEM;
}
}
@@ -625,7 +622,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
mvchip->irqbase = irq_alloc_descs(-1, 0, ngpios, -1);
if (mvchip->irqbase < 0) {
dev_err(&pdev->dev, "no irqs\n");
- kfree(mvchip->chip.label);
return -ENOMEM;
}
@@ -633,7 +629,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
mvchip->membase, handle_level_irq);
if (! gc) {
dev_err(&pdev->dev, "Cannot allocate generic irq_chip\n");
- kfree(mvchip->chip.label);
return -ENOMEM;
}
@@ -668,7 +663,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
irq_remove_generic_chip(gc, IRQ_MSK(ngpios), IRQ_NOREQUEST,
IRQ_LEVEL | IRQ_NOPROBE);
kfree(gc);
- kfree(mvchip->chip.label);
return -ENODEV;
}
--
1.8.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: mvebu: Don't free chip label memory
2013-01-14 10:53 [PATCH] gpio: mvebu: Don't free chip label memory Thierry Reding
@ 2013-01-14 14:15 ` Grant Likely
2013-01-17 11:27 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: Grant Likely @ 2013-01-14 14:15 UTC (permalink / raw)
To: Thierry Reding; +Cc: Linus Walleij, linux-kernel
On Mon, 14 Jan 2013 11:53:20 +0100, Thierry Reding <thierry.reding@avionic-design.de> wrote:
> The gpio_chip.label field is a const char * and assigned the value of a
> call to dev_name(). Memory obtained from dev_name() should not be freed
> by drivers.
>
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Linus, can you put this in your fixes branch?
Thanks,
g.
> ---
> drivers/gpio/gpio-mvebu.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> index 7d9bd94..6819d63 100644
> --- a/drivers/gpio/gpio-mvebu.c
> +++ b/drivers/gpio/gpio-mvebu.c
> @@ -547,7 +547,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
> mvchip->membase = devm_request_and_ioremap(&pdev->dev, res);
> if (! mvchip->membase) {
> dev_err(&pdev->dev, "Cannot ioremap\n");
> - kfree(mvchip->chip.label);
> return -ENOMEM;
> }
>
> @@ -557,14 +556,12 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
> res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> if (! res) {
> dev_err(&pdev->dev, "Cannot get memory resource\n");
> - kfree(mvchip->chip.label);
> return -ENODEV;
> }
>
> mvchip->percpu_membase = devm_request_and_ioremap(&pdev->dev, res);
> if (! mvchip->percpu_membase) {
> dev_err(&pdev->dev, "Cannot ioremap\n");
> - kfree(mvchip->chip.label);
> return -ENOMEM;
> }
> }
> @@ -625,7 +622,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
> mvchip->irqbase = irq_alloc_descs(-1, 0, ngpios, -1);
> if (mvchip->irqbase < 0) {
> dev_err(&pdev->dev, "no irqs\n");
> - kfree(mvchip->chip.label);
> return -ENOMEM;
> }
>
> @@ -633,7 +629,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
> mvchip->membase, handle_level_irq);
> if (! gc) {
> dev_err(&pdev->dev, "Cannot allocate generic irq_chip\n");
> - kfree(mvchip->chip.label);
> return -ENOMEM;
> }
>
> @@ -668,7 +663,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
> irq_remove_generic_chip(gc, IRQ_MSK(ngpios), IRQ_NOREQUEST,
> IRQ_LEVEL | IRQ_NOPROBE);
> kfree(gc);
> - kfree(mvchip->chip.label);
> return -ENODEV;
> }
>
> --
> 1.8.1
>
--
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: mvebu: Don't free chip label memory
2013-01-14 14:15 ` Grant Likely
@ 2013-01-17 11:27 ` Linus Walleij
0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2013-01-17 11:27 UTC (permalink / raw)
To: Grant Likely; +Cc: Thierry Reding, linux-kernel
On Mon, Jan 14, 2013 at 3:15 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Mon, 14 Jan 2013 11:53:20 +0100, Thierry Reding <thierry.reding@avionic-design.de> wrote:
>> The gpio_chip.label field is a const char * and assigned the value of a
>> call to dev_name(). Memory obtained from dev_name() should not be freed
>> by drivers.
>>
>> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>
Yepps, patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-17 11:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-14 10:53 [PATCH] gpio: mvebu: Don't free chip label memory Thierry Reding
2013-01-14 14:15 ` Grant Likely
2013-01-17 11:27 ` Linus Walleij
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.