firmware: arm_scmi: Fix fallback to short name in scmi_pinctrl_attributes()
Sudeep Holla
maintainerPATCH 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.
--- drivers/firmware/arm_scmi/pinctrl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/firmware/arm_scmi/pinctrl.c +4 -4
@@ -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
Quoted 5 lines · Sudeep Holla
In
scmi_pinctrl_attributes(), the return value ofextended_name_get()is returned directly. IfPINCTRL_NAME_GETfailed, 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 successfulPINCTRL_ATTRIBUTEStransfer. On failure,extended_name_get()won't have overwritten name, so the short name copied fromrx->nameremains 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