From 78857b6576180d8a23e41247de2a1d4a5c423a84 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sun, 11 Jun 2023 23:51:42 -0400 Subject: [PATCH] Fixes for 4.14 Signed-off-by: Sasha Levin --- ...-i2c-adapter-in-.remove-s-error-path.patch | 50 +++++++++++++++++++ queue-4.14/series | 1 + 2 files changed, 51 insertions(+) create mode 100644 queue-4.14/i2c-sprd-delete-i2c-adapter-in-.remove-s-error-path.patch diff --git a/queue-4.14/i2c-sprd-delete-i2c-adapter-in-.remove-s-error-path.patch b/queue-4.14/i2c-sprd-delete-i2c-adapter-in-.remove-s-error-path.patch new file mode 100644 index 00000000000..0de31c996d3 --- /dev/null +++ b/queue-4.14/i2c-sprd-delete-i2c-adapter-in-.remove-s-error-path.patch @@ -0,0 +1,50 @@ +From 136fcaced15aeac6f24de974ced0d8e43ae3c3cd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Mar 2023 10:58:19 +0100 +Subject: i2c: sprd: Delete i2c adapter in .remove's error path +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit ca0aa17f2db3468fd017038d23a78e17388e2f67 ] + +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: 8b9ec0719834 ("i2c: Add Spreadtrum I2C controller driver") +Signed-off-by: Uwe Kleine-König +Reviewed-by: Andi Shyti +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + drivers/i2c/busses/i2c-sprd.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c +index 1925c89381194..452b868e5c974 100644 +--- a/drivers/i2c/busses/i2c-sprd.c ++++ b/drivers/i2c/busses/i2c-sprd.c +@@ -581,10 +581,12 @@ static int sprd_i2c_remove(struct platform_device *pdev) + + ret = pm_runtime_get_sync(i2c_dev->dev); + if (ret < 0) +- return ret; ++ dev_err(&pdev->dev, "Failed to resume device (%pe)\n", ERR_PTR(ret)); + + 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_disable(i2c_dev->dev); +-- +2.39.2 + diff --git a/queue-4.14/series b/queue-4.14/series index 4a0ca0a9a23..b5640f05c12 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -14,3 +14,4 @@ input-psmouse-fix-oob-access-in-elantech-protocol.patch drm-amdgpu-fix-xclk-freq-on-chip_stoney.patch ceph-fix-use-after-free-bug-for-inodes-when-flushing-capsnaps.patch bluetooth-fix-use-after-free-in-hci_remove_ltk-hci_remove_irk.patch +i2c-sprd-delete-i2c-adapter-in-.remove-s-error-path.patch -- 2.47.2