Skip to contentSkip to conversation

firmware: arm_scmi: Fix fallback to short name in scmi_pinctrl_attributes()

PATCH Applied Sudeep Holla 1 participant 2 messages Nov 5 – Nov 19 System control & power/management interface (SCPI/SCMI) Message Protocol drivers

lore
Share & tools
lore

Sudeep Holla

author maintainer
#0 lore raw

PATCH 1/1 firmware: arm_scmi: Fix fallback to short name in scmi_pinctrl_attributes()

In scmi_pinctrl_attributes(), the return value of extended_name_get() is returned directly. If PINCTRL_NAME_GET failed, the error propagated to callers - aborting pin/group/function descriptor initialization, despite the short name already being available in name.

Discard the return value of extended_name_get() and return success as intended unconditionally after the successful PINCTRL_ATTRIBUTES transfer. On failure, extended_name_get() won't have overwritten name, so the short name copied from rx->name remains intact, which is exactly the fallback behavior described by the existing comment.

Fixes 2145af01b9cb ("firmware: arm_scmi: Add basic support for SCMI v3.2 pincontrol protocol")
---
 drivers/firmware/arm_scmi/pinctrl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/firmware/arm_scmi/pinctrl.c +4 -4
index 42cb1aef1fe1..c8e26168a8a4 100644
@@ -233,10 +233,10 @@ static int scmi_pinctrl_attributes(const struct scmi_protocol_handle *ph,
 	 * on error just carry on and use already provided short name.
 	 */
 	if (ext_name_flag)
-		ret = ph->hops->extended_name_get(ph, PINCTRL_NAME_GET,
-						  selector, (u32 *)&type, name,
-						  SCMI_MAX_STR_SIZE);
-	return ret;
+		ph->hops->extended_name_get(ph, PINCTRL_NAME_GET,
+					    selector, (u32 *)&type, name,
+					    SCMI_MAX_STR_SIZE);
+	return 0;
 }
 
 struct scmi_pinctrl_ipriv {
Signature · 1 line
2.43.0
author maintainer Applied
#1 lore raw
Quoted 5 lines · Sudeep Holla

In scmi_pinctrl_attributes(), the return value of extended_name_get() is returned directly. If PINCTRL_NAME_GET failed, the error propagated to callers - aborting pin/group/function descriptor initialization, despite the short name already being available in name.

Quoted 7 lines

Discard the return value of extended_name_get() and return success as intended unconditionally after the successful PINCTRL_ATTRIBUTES transfer. On failure, extended_name_get() won't have overwritten name, so the short name copied from rx->name remains intact, which is exactly the fallback behavior described by the existing comment.

[...]

Applied to sudeep.holla/linux (for-next/arm_fw/updates), thanks!

[1/1] firmware: arm_scmi: Fix fallback to short name in scmi_pinctrl_attributes()

      https://git.kernel.org/sudeep.holla/c/6337e8d465bb
Signature · 2 lines
Regards,
Sudeep