mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] i2c: qcom-geni: release runtime PM reference when set_rate fails
@ 2026-09-30 11:16 Rahul Pon
  2026-10-04 14:06 ` Andi Shyti
  2026-10-05  9:06 ` Mukesh Savaliya
  0 siblings, 2 replies; 3+ messages in thread
From: Rahul Pon @ 2026-09-30 11:16 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Mukesh Kumar Savaliya, Viken Dadhaniya, Praveen Talari,
	Konrad Dybcio, linux-i2c, linux-arm-msm, linux-kernel

geni_i2c_xfer() takes a runtime-PM reference with pm_runtime_get_sync()
and then returns directly if the set_rate() callback fails, leaking the
reference and keeping the controller resumed for good. Route that error
through the existing cleanup path, which drops the reference and resets
the transfer state.

Found by code review; compile-tested with arm64 defconfig plus ACPI and
W=1.

Fixes: 10e74f4c5046 ("i2c: qcom-geni: Enable I2C on SA8255p Qualcomm platforms")
Assisted-by: LLM
Signed-off-by: Rahul Pon <theflyingrahul@gmail.com>
---
 drivers/i2c/busses/i2c-qcom-geni.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
index 6a39e21d5e..ed6495ef81 100644
--- a/drivers/i2c/busses/i2c-qcom-geni.c
+++ b/drivers/i2c/busses/i2c-qcom-geni.c
@@ -1003,13 +1003,14 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
 
 	ret = gi2c->dev_data->set_rate(&gi2c->se, gi2c->clk_freq_out);
 	if (ret)
-		return ret;
+		goto out_pm;
 
 	if (gi2c->gpi_mode)
 		ret = geni_i2c_gpi_xfer(gi2c, msgs, num);
 	else
 		ret = geni_i2c_fifo_xfer(gi2c, msgs, num);
 
+out_pm:
 	pm_runtime_put_autosuspend(gi2c->se.dev);
 	gi2c->cur = NULL;
 	gi2c->err = 0;

base-commit: 551c722f40809618230001baccf219193e22fc5a
-- 
2.53.0


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

* Re: [PATCH] i2c: qcom-geni: release runtime PM reference when set_rate fails
  2026-09-30 11:16 [PATCH] i2c: qcom-geni: release runtime PM reference when set_rate fails Rahul Pon
@ 2026-10-04 14:06 ` Andi Shyti
  2026-10-05  9:06 ` Mukesh Savaliya
  1 sibling, 0 replies; 3+ messages in thread
From: Andi Shyti @ 2026-10-04 14:06 UTC (permalink / raw)
  To: Rahul Pon
  Cc: Mukesh Kumar Savaliya, Viken Dadhaniya, Praveen Talari,
	Konrad Dybcio, linux-i2c, linux-arm-msm, linux-kernel

Hi Rahul,

On Wed, Sep 30, 2026 at 04:46:41PM +0530, Rahul Pon wrote:
> geni_i2c_xfer() takes a runtime-PM reference with pm_runtime_get_sync()
> and then returns directly if the set_rate() callback fails, leaking the
> reference and keeping the controller resumed for good. Route that error
> through the existing cleanup path, which drops the reference and resets
> the transfer state.
> 
> Found by code review; compile-tested with arm64 defconfig plus ACPI and
> W=1.
> 
> Fixes: 10e74f4c5046 ("i2c: qcom-geni: Enable I2C on SA8255p Qualcomm platforms")
> Assisted-by: LLM
> Signed-off-by: Rahul Pon <theflyingrahul@gmail.com>

pushed to i2c/i2c-fixes-2.

Thanks,
Andi

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

* Re: [PATCH] i2c: qcom-geni: release runtime PM reference when set_rate fails
  2026-09-30 11:16 [PATCH] i2c: qcom-geni: release runtime PM reference when set_rate fails Rahul Pon
  2026-10-04 14:06 ` Andi Shyti
@ 2026-10-05  9:06 ` Mukesh Savaliya
  1 sibling, 0 replies; 3+ messages in thread
From: Mukesh Savaliya @ 2026-10-05  9:06 UTC (permalink / raw)
  To: Rahul Pon, Andi Shyti
  Cc: Viken Dadhaniya, Praveen Talari, Konrad Dybcio, linux-i2c,
	linux-arm-msm, linux-kernel



On 9/30/2026 4:46 PM, Rahul Pon wrote:
> geni_i2c_xfer() takes a runtime-PM reference with pm_runtime_get_sync()
> and then returns directly if the set_rate() callback fails, leaking the
> reference and keeping the controller resumed for good. Route that error
> through the existing cleanup path, which drops the reference and resets
> the transfer state.
> 
> Found by code review; compile-tested with arm64 defconfig plus ACPI and
> W=1.
> 
> Fixes: 10e74f4c5046 ("i2c: qcom-geni: Enable I2C on SA8255p Qualcomm platforms")
> Assisted-by: LLM
> Signed-off-by: Rahul Pon <theflyingrahul@gmail.com>
> ---
Reviewed-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>

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

end of thread, other threads:[~2026-10-05  9:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-30 11:16 [PATCH] i2c: qcom-geni: release runtime PM reference when set_rate fails Rahul Pon
2026-10-04 14:06 ` Andi Shyti
2026-10-05  9:06 ` Mukesh Savaliya

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®