gpio: mvebu: Don't free chip label memory
PATCH 1/1 gpio: mvebu: Don't free chip label memory
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 <[email protected]>
--- drivers/gpio/gpio-mvebu.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/gpio/gpio-mvebu.c +0 -6
@@ -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 ; }
Signature · 1 line
1.8.1
Quoted 5 lines · Thierry Reding
The gpio_chip.label field is a const char * and assigned the value of a call to
dev_name(). Memory obtained fromdev_name()should not be freed by drivers.Signed-off-by Thierry Reding <[email protected]>
Acked-by Grant Likely <[email protected]>
Linus, can you put this in your fixes branch?
Thanks,
g.
Quoted 58 lines
--- drivers/gpio/gpio-mvebu.c | 6 ------ 1 file changed, 6 deletions(-)drivers/gpio/gpio-mvebu.c +0
-6@@ -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 ; }Signature · 1 line
1.8.1
Signature · 2 lines
Grant Likely, B.Sc, P.Eng. Secret Lab Technologies, Ltd.
Quoted 8 lines · Grant Likely
Quoted 5 lines · Thierry Reding
The gpio_chip.label field is a const char * and assigned the value of a call to
dev_name(). Memory obtained fromdev_name()should not be freed by drivers.Signed-off-by Thierry Reding <[email protected]>Acked-by Grant Likely <[email protected]>
Yepps, patch applied.
Yours,
Linus Walleij