linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] i2c: mpc: drop release for resource allocated with devm_*
@ 2021-04-12 16:00 Wei Yongjun
  2021-04-12 21:09 ` Chris Packham
  2021-04-13 12:20 ` Wolfram Sang
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2021-04-12 16:00 UTC (permalink / raw)
  To: weiyongjun1, Chris Packham, Wolfram Sang
  Cc: linux-i2c, kernel-janitors, Hulk Robot

It's not necessary to release resource which allocated with devm_*
and those release may leads to a double free. And also remove useless
irq_dispose_mapping() call since mapping not created.

Fixes: 09aab7add7bf ("i2c: mpc: use device managed APIs")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/i2c/busses/i2c-mpc.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 46cdb36e2f9b..6e5614acebac 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -759,12 +759,6 @@ static int fsl_i2c_remove(struct platform_device *op)
 	if (i2c->clk_per)
 		clk_disable_unprepare(i2c->clk_per);
 
-	if (i2c->irq)
-		free_irq(i2c->irq, i2c);
-
-	irq_dispose_mapping(i2c->irq);
-	iounmap(i2c->base);
-	kfree(i2c);
 	return 0;
 };
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] i2c: mpc: drop release for resource allocated with devm_*
  2021-04-12 16:00 [PATCH -next] i2c: mpc: drop release for resource allocated with devm_* Wei Yongjun
@ 2021-04-12 21:09 ` Chris Packham
  2021-04-13 12:20 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Packham @ 2021-04-12 21:09 UTC (permalink / raw)
  To: Wei Yongjun, Wolfram Sang; +Cc: linux-i2c, kernel-janitors, Hulk Robot


On 13/04/21 4:00 am, Wei Yongjun wrote:
> It's not necessary to release resource which allocated with devm_*
> and those release may leads to a double free. And also remove useless
> irq_dispose_mapping() call since mapping not created.
>
> Fixes: 09aab7add7bf ("i2c: mpc: use device managed APIs")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Thanks for the fix.

Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>

> ---
>   drivers/i2c/busses/i2c-mpc.c | 6 ------
>   1 file changed, 6 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index 46cdb36e2f9b..6e5614acebac 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -759,12 +759,6 @@ static int fsl_i2c_remove(struct platform_device *op)
>   	if (i2c->clk_per)
>   		clk_disable_unprepare(i2c->clk_per);
>   
> -	if (i2c->irq)
> -		free_irq(i2c->irq, i2c);
> -
> -	irq_dispose_mapping(i2c->irq);
> -	iounmap(i2c->base);
> -	kfree(i2c);
>   	return 0;
>   };
>   
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] i2c: mpc: drop release for resource allocated with devm_*
  2021-04-12 16:00 [PATCH -next] i2c: mpc: drop release for resource allocated with devm_* Wei Yongjun
  2021-04-12 21:09 ` Chris Packham
@ 2021-04-13 12:20 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2021-04-13 12:20 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Chris Packham, linux-i2c, kernel-janitors, Hulk Robot

[-- Attachment #1: Type: text/plain, Size: 463 bytes --]

On Mon, Apr 12, 2021 at 04:00:26PM +0000, Wei Yongjun wrote:
> It's not necessary to release resource which allocated with devm_*
> and those release may leads to a double free. And also remove useless
> irq_dispose_mapping() call since mapping not created.
> 
> Fixes: 09aab7add7bf ("i2c: mpc: use device managed APIs")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-13 12:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 16:00 [PATCH -next] i2c: mpc: drop release for resource allocated with devm_* Wei Yongjun
2021-04-12 21:09 ` Chris Packham
2021-04-13 12:20 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).