Skip to content

Commit 810199f

Browse files
Uwe Kleine-Königwsakernel
authored andcommitted
i2c: xiic: Make sure to disable clock on .remove()
If for whatever reasons pm_runtime_resume_and_get() failed, .remove() is exited early, the clock isn't freed and runtime PM state isn't reset. The right thing to do however is to free all resources that don't need HW access after a problem with runtime PM. Also issue a warning in that case and return 0 to suppress a less helpful warning by the driver core. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 3256412 commit 810199f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/i2c/busses/i2c-xiic.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,11 +858,14 @@ static int xiic_i2c_remove(struct platform_device *pdev)
858858
/* remove adapter & data */
859859
i2c_del_adapter(&i2c->adap);
860860

861-
ret = pm_runtime_resume_and_get(i2c->dev);
861+
ret = pm_runtime_get_sync(i2c->dev);
862+
862863
if (ret < 0)
863-
return ret;
864+
dev_warn(&pdev->dev, "Failed to activate device for removal (%pe)\n",
865+
ERR_PTR(ret));
866+
else
867+
xiic_deinit(i2c);
864868

865-
xiic_deinit(i2c);
866869
pm_runtime_put_sync(i2c->dev);
867870
clk_disable_unprepare(i2c->clk);
868871
pm_runtime_disable(&pdev->dev);

0 commit comments

Comments
 (0)