mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] spmi: pmic-arb: Fix the driver data used by non-data commands
@ 2026-11-02 15:46 Abel Vesa
  2026-11-03  9:28 ` Konrad Dybcio
  0 siblings, 1 reply; 2+ messages in thread
From: Abel Vesa @ 2026-11-02 15:46 UTC (permalink / raw)
  To: Abel Vesa, David Collins, Stephen Boyd, Greg Kroah-Hartman,
	Neil Armstrong, Dan Carpenter
  Cc: linux-arm-msm, linux-kernel, stable, Sashiko, Abel Vesa

Since commit 02922ccbb330 ("spmi: pmic-arb: Register controller for bus
instead of arbiter"), the driver data of each SPMI controller is a
struct spmi_pmic_arb_bus, which points to the arbiter. pmic_arb_cmd()
was not converted along with the other controller callbacks and still
takes the driver data for the arbiter itself, so a non-data command
reads ver_ops from the wrong structure and calls through a bogus
pointer.

No in-tree driver sends non-data commands at the moment, which is why
this has gone unnoticed, but spmi_command_reset() and friends are
exported for any SPMI client to use.

Get the arbiter through the bus, like the other callbacks do.

Fixes: 02922ccbb330 ("spmi: pmic-arb: Register controller for bus instead of arbiter")
Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-29e1d31a-8d20-42c9-a5b3-41a90553d799
Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
---
Prepared with help from an LLM-based assistant.
---
 drivers/spmi/spmi-pmic-arb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 402ffeaff8e2..9ce404ed5272 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -448,7 +448,8 @@ pmic_arb_non_data_cmd_v2(struct spmi_controller *ctrl, u8 opc, u8 sid)
 /* Non-data command */
 static int pmic_arb_cmd(struct spmi_controller *ctrl, u8 opc, u8 sid)
 {
-	struct spmi_pmic_arb *pmic_arb = spmi_controller_get_drvdata(ctrl);
+	struct spmi_pmic_arb_bus *bus = spmi_controller_get_drvdata(ctrl);
+	struct spmi_pmic_arb *pmic_arb = bus->pmic_arb;
 
 	dev_dbg(&ctrl->dev, "cmd op:0x%x sid:%d\n", opc, sid);
 

---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261102-spmi-pmic-arb-cmd-drvdata-fe9a1e308063

Best regards,
--  

Abel


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

* Re: [PATCH] spmi: pmic-arb: Fix the driver data used by non-data commands
  2026-11-02 15:46 [PATCH] spmi: pmic-arb: Fix the driver data used by non-data commands Abel Vesa
@ 2026-11-03  9:28 ` Konrad Dybcio
  0 siblings, 0 replies; 2+ messages in thread
From: Konrad Dybcio @ 2026-11-03  9:28 UTC (permalink / raw)
  To: Abel Vesa, Abel Vesa, David Collins, Stephen Boyd,
	Greg Kroah-Hartman, Neil Armstrong, Dan Carpenter
  Cc: linux-arm-msm, linux-kernel, stable, Sashiko

On 11/2/26 4:46 PM, Abel Vesa wrote:
> Since commit 02922ccbb330 ("spmi: pmic-arb: Register controller for bus
> instead of arbiter"), the driver data of each SPMI controller is a
> struct spmi_pmic_arb_bus, which points to the arbiter. pmic_arb_cmd()
> was not converted along with the other controller callbacks and still
> takes the driver data for the arbiter itself, so a non-data command
> reads ver_ops from the wrong structure and calls through a bogus
> pointer.
> 
> No in-tree driver sends non-data commands at the moment, which is why
> this has gone unnoticed, but spmi_command_reset() and friends are
> exported for any SPMI client to use.
> 
> Get the arbiter through the bus, like the other callbacks do.
> 
> Fixes: 02922ccbb330 ("spmi: pmic-arb: Register controller for bus instead of arbiter")
> Cc: stable@vger.kernel.org
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://sashiko.dev/#/bug/linux-29e1d31a-8d20-42c9-a5b3-41a90553d799
> Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

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

end of thread, other threads:[~2026-11-03  9:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02 15:46 [PATCH] spmi: pmic-arb: Fix the driver data used by non-data commands Abel Vesa
2026-11-03  9:28 ` Konrad Dybcio

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®