linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: imx: don't leak the i2c adapter on error
@ 2019-03-29 12:48 laurentiu.tudor
  2019-03-29 13:33 ` Mukesh Ojha
  2019-03-29 21:08 ` Uwe Kleine-König
  0 siblings, 2 replies; 3+ messages in thread
From: laurentiu.tudor @ 2019-03-29 12:48 UTC (permalink / raw)
  To: linux-i2c, wsa+renesas
  Cc: linux-imx, kernel, linux-arm-kernel, linux-kernel, leoyang.li,
	Laurentiu Tudor

From: Laurentiu Tudor <laurentiu.tudor@nxp.com>

Make sure to free the i2c adapter on the error exit path.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
---
 drivers/i2c/busses/i2c-imx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 42fed40198a0..2dfd33f48cd8 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1169,11 +1169,13 @@ static int i2c_imx_probe(struct platform_device *pdev)
 	/* Init DMA config if supported */
 	ret = i2c_imx_dma_request(i2c_imx, phy_addr);
 	if (ret < 0)
-		goto clk_notifier_unregister;
+		goto del_adapter;
 
 	dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");
 	return 0;   /* Return OK */
 
+del_adapter:
+	 i2c_del_adapter(&i2c_imx->adapter);
 clk_notifier_unregister:
 	clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
 rpm_disable:
-- 
2.17.1

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

* Re: [PATCH] i2c: imx: don't leak the i2c adapter on error
  2019-03-29 12:48 [PATCH] i2c: imx: don't leak the i2c adapter on error laurentiu.tudor
@ 2019-03-29 13:33 ` Mukesh Ojha
  2019-03-29 21:08 ` Uwe Kleine-König
  1 sibling, 0 replies; 3+ messages in thread
From: Mukesh Ojha @ 2019-03-29 13:33 UTC (permalink / raw)
  To: laurentiu.tudor, linux-i2c, wsa+renesas
  Cc: linux-kernel, leoyang.li, linux-imx, kernel, linux-arm-kernel


On 3/29/2019 6:18 PM, laurentiu.tudor@nxp.com wrote:
> From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
>
> Make sure to free the i2c adapter on the error exit path.
>
> Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

Cheers,
-Mukesh
> ---
>   drivers/i2c/busses/i2c-imx.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 42fed40198a0..2dfd33f48cd8 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1169,11 +1169,13 @@ static int i2c_imx_probe(struct platform_device *pdev)
>   	/* Init DMA config if supported */
>   	ret = i2c_imx_dma_request(i2c_imx, phy_addr);
>   	if (ret < 0)
> -		goto clk_notifier_unregister;
> +		goto del_adapter;
>   
>   	dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");
>   	return 0;   /* Return OK */
>   
> +del_adapter:
> +	 i2c_del_adapter(&i2c_imx->adapter);
>   clk_notifier_unregister:
>   	clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
>   rpm_disable:

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

* Re: [PATCH] i2c: imx: don't leak the i2c adapter on error
  2019-03-29 12:48 [PATCH] i2c: imx: don't leak the i2c adapter on error laurentiu.tudor
  2019-03-29 13:33 ` Mukesh Ojha
@ 2019-03-29 21:08 ` Uwe Kleine-König
  1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2019-03-29 21:08 UTC (permalink / raw)
  To: laurentiu.tudor
  Cc: linux-i2c, wsa+renesas, linux-kernel, leoyang.li, linux-imx,
	kernel, linux-arm-kernel, Oleksij Rempel

On Fri, Mar 29, 2019 at 02:48:17PM +0200, laurentiu.tudor@nxp.com wrote:
> From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
> 
> Make sure to free the i2c adapter on the error exit path.
> 
> Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>

>  drivers/i2c/busses/i2c-imx.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 42fed40198a0..2dfd33f48cd8 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1169,11 +1169,13 @@ static int i2c_imx_probe(struct platform_device *pdev)
>  	/* Init DMA config if supported */
>  	ret = i2c_imx_dma_request(i2c_imx, phy_addr);
>  	if (ret < 0)
> -		goto clk_notifier_unregister;
> +		goto del_adapter;
>  
>  	dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");
>  	return 0;   /* Return OK */
>  
> +del_adapter:
> +	 i2c_del_adapter(&i2c_imx->adapter);

Indention problem here, please remove the superflous space here.

Other than that:

Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fixes: e1ab9a468e3b ("i2c: imx: improve the error handling in i2c_imx_dma_request()")

Thanks
Uwe

>  clk_notifier_unregister:
>  	clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
>  rpm_disable:
> -- 
> 2.17.1
> 
> 
> 

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

end of thread, other threads:[~2019-03-29 21:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-29 12:48 [PATCH] i2c: imx: don't leak the i2c adapter on error laurentiu.tudor
2019-03-29 13:33 ` Mukesh Ojha
2019-03-29 21:08 ` Uwe Kleine-König

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).