mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] soc: qcom: pmic_glink_altmode: Fix printing of a fwnode with %pOFn
@ 2026-11-02  0:33 Asdlerto Korry
  2026-11-02  8:49 ` Konrad Dybcio
  0 siblings, 1 reply; 2+ messages in thread
From: Asdlerto Korry @ 2026-11-02  0:33 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio
  Cc: Abel Vesa, Neil Armstrong, linux-arm-msm, linux-kernel, Asdlerto Korry

pmic_glink_altmode_probe() walks the child nodes with
device_for_each_child_node(), which yields a struct fwnode_handle, but
prints it with %pOFn, which expects a struct device_node. vsprintf then
treats the fwnode_handle as a device_node and passes &dn->fwnode to
fwnode_get_name(), i.e. a pointer into the middle of the handle, and
calls through a garbage fwnode->ops. The error path ("missing reg
property") therefore oopses instead of printing the message:

  lr : fwnode_get_name+0x34/0x50
  ...
  device_node_string
  pointer
  vsnprintf
  ...
  pmic_glink_altmode_probe

It was hit on a Samsung Galaxy M52 5G (SM7325) whose vendor device tree
has an extra "qcom,pmic-glink" compatible node without a reg property.

Use %pfwP, the specifier for the name of a fwnode.

Fixes: 080b4e24852b ("soc: qcom: pmic_glink: Introduce altmode support")
Signed-off-by: Asdlerto Korry <korryasdlerto@gmail.com>
---
 drivers/soc/qcom/pmic_glink_altmode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c
index 465e5d2316a0..6f3737b096cf 100644
--- a/drivers/soc/qcom/pmic_glink_altmode.c
+++ b/drivers/soc/qcom/pmic_glink_altmode.c
@@ -596,7 +596,7 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev,
 	device_for_each_child_node(dev, fwnode) {
 		ret = fwnode_property_read_u32(fwnode, "reg", &port);
 		if (ret < 0) {
-			dev_err(dev, "missing reg property of %pOFn\n", fwnode);
+			dev_err(dev, "missing reg property of %pfwP\n", fwnode);
 			fwnode_handle_put(fwnode);
 			return ret;
 		}
-- 
2.25.1


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

* Re: [PATCH] soc: qcom: pmic_glink_altmode: Fix printing of a fwnode with %pOFn
  2026-11-02  0:33 [PATCH] soc: qcom: pmic_glink_altmode: Fix printing of a fwnode with %pOFn Asdlerto Korry
@ 2026-11-02  8:49 ` Konrad Dybcio
  0 siblings, 0 replies; 2+ messages in thread
From: Konrad Dybcio @ 2026-11-02  8:49 UTC (permalink / raw)
  To: Asdlerto Korry, Bjorn Andersson, Konrad Dybcio
  Cc: Abel Vesa, Neil Armstrong, linux-arm-msm, linux-kernel

On 11/2/26 1:33 AM, Asdlerto Korry wrote:
> pmic_glink_altmode_probe() walks the child nodes with
> device_for_each_child_node(), which yields a struct fwnode_handle, but
> prints it with %pOFn, which expects a struct device_node. vsprintf then
> treats the fwnode_handle as a device_node and passes &dn->fwnode to
> fwnode_get_name(), i.e. a pointer into the middle of the handle, and
> calls through a garbage fwnode->ops. The error path ("missing reg
> property") therefore oopses instead of printing the message:
> 
>   lr : fwnode_get_name+0x34/0x50
>   ...
>   device_node_string
>   pointer
>   vsnprintf
>   ...
>   pmic_glink_altmode_probe
> 
> It was hit on a Samsung Galaxy M52 5G (SM7325) whose vendor device tree
> has an extra "qcom,pmic-glink" compatible node without a reg property.

FWIW Vendor DTs are not supposed to work with the upstream kernel
(because they diverge so much from the upstream dt-bindings)> 
> Use %pfwP, the specifier for the name of a fwnode.
> 
> Fixes: 080b4e24852b ("soc: qcom: pmic_glink: Introduce altmode support")
> Signed-off-by: Asdlerto Korry <korryasdlerto@gmail.com>
> ---

But the issue and fix are of course real and valid

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

Konrad

>  drivers/soc/qcom/pmic_glink_altmode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c
> index 465e5d2316a0..6f3737b096cf 100644
> --- a/drivers/soc/qcom/pmic_glink_altmode.c
> +++ b/drivers/soc/qcom/pmic_glink_altmode.c
> @@ -596,7 +596,7 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev,
>  	device_for_each_child_node(dev, fwnode) {
>  		ret = fwnode_property_read_u32(fwnode, "reg", &port);
>  		if (ret < 0) {
> -			dev_err(dev, "missing reg property of %pOFn\n", fwnode);
> +			dev_err(dev, "missing reg property of %pfwP\n", fwnode);
>  			fwnode_handle_put(fwnode);
>  			return ret;
>  		}

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

end of thread, other threads:[~2026-11-02  8:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02  0:33 [PATCH] soc: qcom: pmic_glink_altmode: Fix printing of a fwnode with %pOFn Asdlerto Korry
2026-11-02  8:49 ` 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®