Skip to content

Commit 3ace689

Browse files
tudorlWolfram Sang
authored andcommitted
i2c: imx: don't leak the i2c adapter on error
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-König <u.kleine-koenig@pengutronix.de> Fixes: e1ab9a4 ("i2c: imx: improve the error handling in i2c_imx_dma_request()") Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
1 parent 79a3aaa commit 3ace689

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/i2c/busses/i2c-imx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,11 +1169,13 @@ static int i2c_imx_probe(struct platform_device *pdev)
11691169
/* Init DMA config if supported */
11701170
ret = i2c_imx_dma_request(i2c_imx, phy_addr);
11711171
if (ret < 0)
1172-
goto clk_notifier_unregister;
1172+
goto del_adapter;
11731173

11741174
dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");
11751175
return 0; /* Return OK */
11761176

1177+
del_adapter:
1178+
i2c_del_adapter(&i2c_imx->adapter);
11771179
clk_notifier_unregister:
11781180
clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
11791181
rpm_disable:

0 commit comments

Comments
 (0)