usb: typec: ucsi: Fix printing of a fwnode with %pOFn
PATCH 1/1 usb: typec: ucsi: Fix printing of a fwnode with %pOFn
ucsi_glink and ucsi_huawei_gaokun walk the connector nodes with device_for_each_child_node(), which yields a struct fwnode_handle, but print it with %pOFn, which expects a struct device_node. vsprintf then treats the fwnode_handle as a device_node and calls fwnode_get_name() on a pointer into the middle of it, so the "missing reg property" error path oopses instead of printing the message (seen with the same code in pmic_glink_altmode on a Samsung Galaxy M52 5G).
Use %pfwP, the specifier for the name of a fwnode.
--- drivers/usb/typec/ucsi/ucsi_glink.c | 2 +- drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/typec/ucsi/ucsi_glink.c +1 -1
@@ -433,7 +433,7 @@ static int pmic_glink_ucsi_probe(struct auxiliary_device *adev, 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);return ret; }
drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c +1 -1
@@ -430,7 +430,7 @@ static int gaokun_ucsi_ports_init(struct gaokun_ucsi *uec)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; }
Signature · 1 line
2.25.1
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 8 lines
ucsi_glinkanducsi_huawei_gaokunwalk the connector nodes withdevice_for_each_child_node(), which yields a structfwnode_handle, but print it with %pOFn, which expects a structdevice_node. vsprintf then treats thefwnode_handleas adevice_nodeand callsfwnode_get_name()on a pointer into the middle of it, so the "missing reg property" error path oopses instead of printing the message (seen with the same code inpmic_glink_altmodeon a Samsung Galaxy M52 5G).
Quoted 5 lines
Use %pfwP, the specifier for the name of a fwnode.
Fixes c6165ed2f425 ("usb: ucsi: glink: use the connector orientation GPIO to provide switch events")Fixes 00327d7f2c8c ("usb: typec: ucsi: add Huawei Matebook E Go ucsi driver")Signed-off-by Asdlerto Korry <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 8 lines · Asdlerto Korry
ucsi_glinkanducsi_huawei_gaokunwalk the connector nodes withdevice_for_each_child_node(), which yields a structfwnode_handle, but print it with %pOFn, which expects a structdevice_node. vsprintf then treats thefwnode_handleas adevice_nodeand callsfwnode_get_name()on a pointer into the middle of it, so the "missing reg property" error path oopses instead of printing the message (seen with the same code inpmic_glink_altmodeon a Samsung Galaxy M52 5G).
Quoted 6 lines
Use %pfwP, the specifier for the name of a fwnode.
Fixes c6165ed2f425 ("usb: ucsi: glink: use the connector orientation GPIO to provide switch events")Fixes 00327d7f2c8c ("usb: typec: ucsi: add Huawei Matebook E Go ucsi driver")Signed-off-by Asdlerto Korry <[email protected]>---
Konrad
Quoted 8 lines · Asdlerto Korry
ucsi_glinkanducsi_huawei_gaokunwalk the connector nodes withdevice_for_each_child_node(), which yields a structfwnode_handle, but print it with %pOFn, which expects a structdevice_node. vsprintf then treats thefwnode_handleas adevice_nodeand callsfwnode_get_name()on a pointer into the middle of it, so the "missing reg property" error path oopses instead of printing the message (seen with the same code inpmic_glink_altmodeon a Samsung Galaxy M52 5G).
Quoted 5 lines
Use %pfwP, the specifier for the name of a fwnode.
Fixes c6165ed2f425 ("usb: ucsi: glink: use the connector orientation GPIO to provide switch events")Fixes 00327d7f2c8c ("usb: typec: ucsi: add Huawei Matebook E Go ucsi driver")Signed-off-by Asdlerto Korry <[email protected]>
Quoted 33 lines
--- drivers/usb/typec/ucsi/ucsi_glink.c | 2 +- drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/usb/typec/ucsi/ucsi_glink.c +1
-1@@ -433,7 +433,7 @@ static int pmic_glink_ucsi_probe(struct auxiliary_device *adev, 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);return ret; }drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c +1
-1@@ -430,7 +430,7 @@ static int gaokun_ucsi_ports_init(struct gaokun_ucsi *uec)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; }Signature · 1 line
2.25.1
Signature · 1 line
heikki