Commit ca0aa17f authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Wolfram Sang

i2c: sprd: Delete i2c adapter in .remove's error path

If pm runtime resume fails the .remove callback used to exit early. This
resulted in an error message by the driver core but the device gets
removed anyhow. This lets the registered i2c adapter stay around with an
unbound parent device.

So only skip clk disabling if resume failed, but do delete the adapter.

Fixes: 8b9ec071 ("i2c: Add Spreadtrum I2C controller driver")
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: default avatarAndi Shyti <andi.shyti@kernel.org>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 5578d0a7
...@@ -576,12 +576,14 @@ static int sprd_i2c_remove(struct platform_device *pdev) ...@@ -576,12 +576,14 @@ static int sprd_i2c_remove(struct platform_device *pdev)
struct sprd_i2c *i2c_dev = platform_get_drvdata(pdev); struct sprd_i2c *i2c_dev = platform_get_drvdata(pdev);
int ret; int ret;
ret = pm_runtime_resume_and_get(i2c_dev->dev); ret = pm_runtime_get_sync(i2c_dev->dev);
if (ret < 0) if (ret < 0)
return ret; dev_err(&pdev->dev, "Failed to resume device (%pe)\n", ERR_PTR(ret));
i2c_del_adapter(&i2c_dev->adap); i2c_del_adapter(&i2c_dev->adap);
clk_disable_unprepare(i2c_dev->clk);
if (ret >= 0)
clk_disable_unprepare(i2c_dev->clk);
pm_runtime_put_noidle(i2c_dev->dev); pm_runtime_put_noidle(i2c_dev->dev);
pm_runtime_disable(i2c_dev->dev); pm_runtime_disable(i2c_dev->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment