linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] i2c: imx: don't leak the i2c adapter on error
@ 2019-04-01 10:14 laurentiu.tudor
  2019-04-03 20:47 ` Wolfram Sang
  0 siblings, 1 reply; 4+ messages in thread
From: laurentiu.tudor @ 2019-04-01 10:14 UTC (permalink / raw)
  To: u.kleine-koenig, mojha, 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>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Reviewed-by: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
Fixes: e1ab9a468e3b ("i2c: imx: improve the error handling in i2c_imx_dma_request()")
---
Changes in v2:
 - fixed formatting glitch

 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..c0c3043b5d61 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] 4+ messages in thread

* Re: [PATCH v2] i2c: imx: don't leak the i2c adapter on error
  2019-04-01 10:14 [PATCH v2] i2c: imx: don't leak the i2c adapter on error laurentiu.tudor
@ 2019-04-03 20:47 ` Wolfram Sang
  2019-04-06 15:48   ` Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2019-04-03 20:47 UTC (permalink / raw)
  To: laurentiu.tudor
  Cc: u.kleine-koenig, mojha, linux-i2c, wsa+renesas, linux-imx,
	kernel, linux-arm-kernel, linux-kernel, leoyang.li

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

On Mon, Apr 01, 2019 at 01:14:37PM +0300, 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>
> Reviewed-by: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
> Fixes: e1ab9a468e3b ("i2c: imx: improve the error handling in i2c_imx_dma_request()")

Applied to for-current, thanks!


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

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

* Re: [PATCH v2] i2c: imx: don't leak the i2c adapter on error
  2019-04-03 20:47 ` Wolfram Sang
@ 2019-04-06 15:48   ` Uwe Kleine-König
  2019-04-06 15:58     ` Wolfram Sang
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2019-04-06 15:48 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: laurentiu.tudor, mojha, linux-i2c, wsa+renesas, linux-imx,
	kernel, linux-arm-kernel, linux-kernel, leoyang.li

Hey Wolfram,

On Wed, Apr 03, 2019 at 10:47:56PM +0200, Wolfram Sang wrote:
> On Mon, Apr 01, 2019 at 01:14:37PM +0300, 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>
> > Reviewed-by: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
> > Fixes: e1ab9a468e3b ("i2c: imx: improve the error handling in i2c_imx_dma_request()")
> 
> Applied to for-current, thanks!

Is your tree already stable? If not, would you mind correcting my name
in 9b0a9982d8b465e0394db10f15ba53f1a8d60e21?

Best regards and thanks in advance from Freiburg
Uwe

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

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

* Re: [PATCH v2] i2c: imx: don't leak the i2c adapter on error
  2019-04-06 15:48   ` Uwe Kleine-König
@ 2019-04-06 15:58     ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2019-04-06 15:58 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: laurentiu.tudor, mojha, linux-i2c, wsa+renesas, linux-imx,
	kernel, linux-arm-kernel, linux-kernel, leoyang.li

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

On Sat, Apr 06, 2019 at 05:48:47PM +0200, Uwe Kleine-König wrote:
> Hey Wolfram,
> 
> On Wed, Apr 03, 2019 at 10:47:56PM +0200, Wolfram Sang wrote:
> > On Mon, Apr 01, 2019 at 01:14:37PM +0300, 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>
> > > Reviewed-by: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
> > > Fixes: e1ab9a468e3b ("i2c: imx: improve the error handling in i2c_imx_dma_request()")
> > 
> > Applied to for-current, thanks!
> 
> Is your tree already stable? If not, would you mind correcting my name
> in 9b0a9982d8b465e0394db10f15ba53f1a8d60e21?

It is stable, but I created an i2c/for-current-fixed branch just for you
:)


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

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

end of thread, other threads:[~2019-04-06 15:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-01 10:14 [PATCH v2] i2c: imx: don't leak the i2c adapter on error laurentiu.tudor
2019-04-03 20:47 ` Wolfram Sang
2019-04-06 15:48   ` Uwe Kleine-König
2019-04-06 15:58     ` 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).