diff mbox

drivers/ata/pata_mpc52xx.c: add missing kfree

Message ID 1331402199-8000-1-git-send-email-Julia.Lawall@lip6.fr
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Julia Lawall March 10, 2012, 5:56 p.m. UTC
From: Julia Lawall <Julia.Lawall@lip6.fr>

There is no need to call the devm cleanup functions on failure of a probe
or remove function.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/ata/pata_mpc52xx.c |   11 -----------
 1 file changed, 11 deletions(-)


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

Comments

Wolfram Sang March 10, 2012, 6:13 p.m. UTC | #1
On Sat, Mar 10, 2012 at 06:56:39PM +0100, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> There is no need to call the devm cleanup functions on failure of a probe
> or remove function.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Right. Only the subject is bogus and the maintainer for MPC5xxx is Anatolij
meanwhile :)

Other than that:

Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Walter Harms March 10, 2012, 6:32 p.m. UTC | #2
Am 10.03.2012 18:56, schrieb Julia Lawall:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> There is no need to call the devm cleanup functions on failure of a probe
> or remove function.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/ata/pata_mpc52xx.c |   11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
> index 00748ae..1f02008 100644
> --- a/drivers/ata/pata_mpc52xx.c
> +++ b/drivers/ata/pata_mpc52xx.c
> @@ -806,17 +806,12 @@ mpc52xx_ata_probe(struct platform_device *op)
>  	return 0;
>  
>   err:
> -	devm_release_mem_region(&op->dev, res_mem.start, sizeof(*ata_regs));
>  	if (ata_irq)
>  		irq_dispose_mapping(ata_irq);
>  	if (task_irq)
>  		irq_dispose_mapping(task_irq);

hi julia,
i did a quick look at lxr and it showed that irq_dispose_mapping()
is only used with powerpc, and here is it checking for
	if (virq == NO_IRQ)
            return;

I do not know how current the lxt on free-electrons.com is but perhaps
it is possible to dump the if (ata_irq) stuff.

can you double check it ?

re,
 wh


>  	if (dmatsk)
>  		bcom_ata_release(dmatsk);
> -	if (ata_regs)
> -		devm_iounmap(&op->dev, ata_regs);
> -	if (priv)
> -		devm_kfree(&op->dev, priv);
>  	return rv;
>  }
>  
> @@ -835,12 +830,6 @@ mpc52xx_ata_remove(struct platform_device *op)
>  	bcom_ata_release(priv->dmatsk);
>  	irq_dispose_mapping(priv->ata_irq);
>  
> -	/* Clear up IO allocations */
> -	devm_iounmap(&op->dev, priv->ata_regs);
> -	devm_release_mem_region(&op->dev, priv->ata_regs_pa,
> -				sizeof(*priv->ata_regs));
> -	devm_kfree(&op->dev, priv);
> -
>  	return 0;
>  }
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Joe Perches March 10, 2012, 6:32 p.m. UTC | #3
On Sat, 2012-03-10 at 19:13 +0100, Wolfram Sang wrote:
> On Sat, Mar 10, 2012 at 06:56:39PM +0100, Julia Lawall wrote:
> > From: Julia Lawall <Julia.Lawall@lip6.fr>
> > There is no need to call the devm cleanup functions on failure of a probe
> > or remove function.
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> the maintainer for MPC5xxx is Anatolij

Anatolij is not listed as a maintainer for this file
nor has he ever written or signed a patch for it.

It'd be possible to add patterns to MAINTAINERS
if Anatolij really wants to see changes to drivers.

Something like:

LINUX FOR POWERPC EMBEDDED MPC5XXX
M:	Anatolij Gustschin <agust@denx.de>
L:	linuxppc-dev@lists.ozlabs.org
T:	git git://git.denx.de/linux-2.6-agust.git
S:	Maintained
F:	arch/powerpc/platforms/512x/
F:	arch/powerpc/platforms/52xx/
F:	*/*/*mpc5[\dx][\dx][\dx]*
F:	*/*/*/*mpc5[\dx][\dx][\dx]*
F:	*/*/*/*/*mpc5[\dx][\dx][\dx]*


--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang March 10, 2012, 6:44 p.m. UTC | #4
> Anatolij is not listed as a maintainer for this file
> nor has he ever written or signed a patch for it.

I noticed that Grant was in CC, assumed that it was because of his previous MPC
maintainership and mentioned that Anatolij took over. Nothing more, just wanted
to help.

> It'd be possible to add patterns to MAINTAINERS
> if Anatolij really wants to see changes to drivers.

It seems a bit too much for my taste (hardly readable? false positives?), but
then again, it is not my decision, but Anatolij's :)

Thanks!
Joe Perches March 10, 2012, 7:22 p.m. UTC | #5
On Sat, 2012-03-10 at 19:44 +0100, Wolfram Sang wrote:
> > Anatolij is not listed as a maintainer for this file
> > nor has he ever written or signed a patch for it.
> I noticed that Grant was in CC, assumed that it was because of his previous MPC
> maintainership and mentioned that Anatolij took over. Nothing more, just wanted
> to help.

Actually, it's because there's a K: of_get_property
line in OPEN FIRMWARE and the file has one.

I suppose that get_maintainers could be told to
ignore K: entries when using -f <file>.

> > It'd be possible to add patterns to MAINTAINERS
> > if Anatolij really wants to see changes to drivers.
> It seems a bit too much for my taste (hardly readable? false positives?),

There are no false positives as far as I can tell.
Just using *mpc5* doesn't give any either today.
It's perlish so the whole thing is gibberish anyway.


--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Julia Lawall March 10, 2012, 9:50 p.m. UTC | #6
On Sat, 10 Mar 2012, walter harms wrote:

>
>
> Am 10.03.2012 18:56, schrieb Julia Lawall:
>> From: Julia Lawall <Julia.Lawall@lip6.fr>
>>
>> There is no need to call the devm cleanup functions on failure of a probe
>> or remove function.
>>
>> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>>
>> ---
>>  drivers/ata/pata_mpc52xx.c |   11 -----------
>>  1 file changed, 11 deletions(-)
>>
>> diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
>> index 00748ae..1f02008 100644
>> --- a/drivers/ata/pata_mpc52xx.c
>> +++ b/drivers/ata/pata_mpc52xx.c
>> @@ -806,17 +806,12 @@ mpc52xx_ata_probe(struct platform_device *op)
>>  	return 0;
>>
>>   err:
>> -	devm_release_mem_region(&op->dev, res_mem.start, sizeof(*ata_regs));
>>  	if (ata_irq)
>>  		irq_dispose_mapping(ata_irq);
>>  	if (task_irq)
>>  		irq_dispose_mapping(task_irq);
>
> hi julia,
> i did a quick look at lxr and it showed that irq_dispose_mapping()
> is only used with powerpc, and here is it checking for
> 	if (virq == NO_IRQ)
>            return;
>
> I do not know how current the lxt on free-electrons.com is but perhaps
> it is possible to dump the if (ata_irq) stuff.
>
> can you double check it ?

The definition in v3.2.9/kernel/irq/irqdomain.c does nothing but says:

nothing yet; will be filled when support for dynamic allocation of
irq_descs is added to irq_domain

So it would seem better to keep the call.  On the other hand, the error 
handling code of this function seems to be a mess.  When the 
initialization of ata_irq fails, it just returns instead of cleaning up. 
Prior code goes to err.  On ther other hand, now that the devm cleanups 
are gone, it is the goto err, which is unnecessary.  I'll look at the code 
some more.

julia

>
> re,
> wh
>
>
>>  	if (dmatsk)
>>  		bcom_ata_release(dmatsk);
>> -	if (ata_regs)
>> -		devm_iounmap(&op->dev, ata_regs);
>> -	if (priv)
>> -		devm_kfree(&op->dev, priv);
>>  	return rv;
>>  }
>>
>> @@ -835,12 +830,6 @@ mpc52xx_ata_remove(struct platform_device *op)
>>  	bcom_ata_release(priv->dmatsk);
>>  	irq_dispose_mapping(priv->ata_irq);
>>
>> -	/* Clear up IO allocations */
>> -	devm_iounmap(&op->dev, priv->ata_regs);
>> -	devm_release_mem_region(&op->dev, priv->ata_regs_pa,
>> -				sizeof(*priv->ata_regs));
>> -	devm_kfree(&op->dev, priv);
>> -
>>  	return 0;
>>  }
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov March 11, 2012, 10:04 a.m. UTC | #7
Hello.

On 10-03-2012 21:56, Julia Lawall wrote:

> From: Julia Lawall<Julia.Lawall@lip6.fr>

> There is no need to call the devm cleanup functions on failure of a probe
> or remove function.

    This doesn't correlate with the subject.

> Signed-off-by: Julia Lawall<Julia.Lawall@lip6.fr>

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index 00748ae..1f02008 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -806,17 +806,12 @@  mpc52xx_ata_probe(struct platform_device *op)
 	return 0;
 
  err:
-	devm_release_mem_region(&op->dev, res_mem.start, sizeof(*ata_regs));
 	if (ata_irq)
 		irq_dispose_mapping(ata_irq);
 	if (task_irq)
 		irq_dispose_mapping(task_irq);
 	if (dmatsk)
 		bcom_ata_release(dmatsk);
-	if (ata_regs)
-		devm_iounmap(&op->dev, ata_regs);
-	if (priv)
-		devm_kfree(&op->dev, priv);
 	return rv;
 }
 
@@ -835,12 +830,6 @@  mpc52xx_ata_remove(struct platform_device *op)
 	bcom_ata_release(priv->dmatsk);
 	irq_dispose_mapping(priv->ata_irq);
 
-	/* Clear up IO allocations */
-	devm_iounmap(&op->dev, priv->ata_regs);
-	devm_release_mem_region(&op->dev, priv->ata_regs_pa,
-				sizeof(*priv->ata_regs));
-	devm_kfree(&op->dev, priv);
-
 	return 0;
 }