* [PATCH] pata_octeon_cf: fix ata_host_activate() failure handling
@ 2014-03-31 17:53 Bartlomiej Zolnierkiewicz
2014-03-31 18:14 ` David Daney
2014-03-31 21:26 ` Guenter Roeck
0 siblings, 2 replies; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2014-03-31 17:53 UTC (permalink / raw)
To: Tejun Heo; +Cc: Ralf Baechle, linux-ide, linux-mips, linux-kernel
Add missing kfree() call to ata_host_activate() failure path.
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
drivers/ata/pata_octeon_cf.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
Index: b/drivers/ata/pata_octeon_cf.c
===================================================================
--- a/drivers/ata/pata_octeon_cf.c 2014-03-14 16:45:04.320724377 +0100
+++ b/drivers/ata/pata_octeon_cf.c 2014-03-31 18:58:44.367604046 +0200
@@ -1020,13 +1020,16 @@ static int octeon_cf_probe(struct platfo
ata_port_desc(ap, "cmd %p ctl %p", base, ap->ioaddr.ctl_addr);
-
dev_info(&pdev->dev, "version " DRV_VERSION" %d bit%s.\n",
is_16bit ? 16 : 8,
cf_port->is_true_ide ? ", True IDE" : "");
- return ata_host_activate(host, irq, irq_handler,
- IRQF_SHARED, &octeon_cf_sht);
+ rv = ata_host_activate(host, irq, irq_handler,
+ IRQF_SHARED, &octeon_cf_sht);
+ if (rv)
+ goto free_cf_port;
+
+ return 0;
free_cf_port:
kfree(cf_port);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pata_octeon_cf: fix ata_host_activate() failure handling
2014-03-31 17:53 [PATCH] pata_octeon_cf: fix ata_host_activate() failure handling Bartlomiej Zolnierkiewicz
@ 2014-03-31 18:14 ` David Daney
2014-03-31 21:26 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: David Daney @ 2014-03-31 18:14 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz
Cc: Tejun Heo, Ralf Baechle, linux-ide, linux-mips, linux-kernel
On 03/31/2014 10:53 AM, Bartlomiej Zolnierkiewicz wrote:
> Add missing kfree() call to ata_host_activate() failure path.
>
Are you seeing failures in real systems, or is this just a change to fix
a theoretical memory leak?
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Did you test the patch on real hardware? If so, you can add:
Acked-By: David Daney <david.daney@cavium.com>
Otherwise, somebody will have to go and test it.
Thanks,
David Daney
> ---
> drivers/ata/pata_octeon_cf.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> Index: b/drivers/ata/pata_octeon_cf.c
> ===================================================================
> --- a/drivers/ata/pata_octeon_cf.c 2014-03-14 16:45:04.320724377 +0100
> +++ b/drivers/ata/pata_octeon_cf.c 2014-03-31 18:58:44.367604046 +0200
> @@ -1020,13 +1020,16 @@ static int octeon_cf_probe(struct platfo
>
> ata_port_desc(ap, "cmd %p ctl %p", base, ap->ioaddr.ctl_addr);
>
> -
> dev_info(&pdev->dev, "version " DRV_VERSION" %d bit%s.\n",
> is_16bit ? 16 : 8,
> cf_port->is_true_ide ? ", True IDE" : "");
>
> - return ata_host_activate(host, irq, irq_handler,
> - IRQF_SHARED, &octeon_cf_sht);
> + rv = ata_host_activate(host, irq, irq_handler,
> + IRQF_SHARED, &octeon_cf_sht);
> + if (rv)
> + goto free_cf_port;
> +
> + return 0;
>
> free_cf_port:
> kfree(cf_port);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pata_octeon_cf: fix ata_host_activate() failure handling
2014-03-31 17:53 [PATCH] pata_octeon_cf: fix ata_host_activate() failure handling Bartlomiej Zolnierkiewicz
2014-03-31 18:14 ` David Daney
@ 2014-03-31 21:26 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2014-03-31 21:26 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz, Tejun Heo
Cc: Ralf Baechle, linux-ide, linux-mips, linux-kernel
On 03/31/2014 10:53 AM, Bartlomiej Zolnierkiewicz wrote:
> Add missing kfree() call to ata_host_activate() failure path.
>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> ---
> drivers/ata/pata_octeon_cf.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> Index: b/drivers/ata/pata_octeon_cf.c
> ===================================================================
> --- a/drivers/ata/pata_octeon_cf.c 2014-03-14 16:45:04.320724377 +0100
> +++ b/drivers/ata/pata_octeon_cf.c 2014-03-31 18:58:44.367604046 +0200
> @@ -1020,13 +1020,16 @@ static int octeon_cf_probe(struct platfo
>
> ata_port_desc(ap, "cmd %p ctl %p", base, ap->ioaddr.ctl_addr);
>
> -
> dev_info(&pdev->dev, "version " DRV_VERSION" %d bit%s.\n",
> is_16bit ? 16 : 8,
> cf_port->is_true_ide ? ", True IDE" : "");
>
> - return ata_host_activate(host, irq, irq_handler,
> - IRQF_SHARED, &octeon_cf_sht);
> + rv = ata_host_activate(host, irq, irq_handler,
> + IRQF_SHARED, &octeon_cf_sht);
> + if (rv)
> + goto free_cf_port;
> +
Just a few lines above:
rv = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (rv)
return rv;
So you don't really completely fix the leak, it be theoretic or not.
It might be better (and actually simplify the code) to use devm_kzalloc().
Guenter
> + return 0;
>
> free_cf_port:
> kfree(cf_port);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-31 21:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-31 17:53 [PATCH] pata_octeon_cf: fix ata_host_activate() failure handling Bartlomiej Zolnierkiewicz
2014-03-31 18:14 ` David Daney
2014-03-31 21:26 ` Guenter Roeck
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.