[V5,3/9] firmware: imx: scu: drop return value check

Message ID 20230731090449.2845997-4-peng.fan@oss.nxp.com
State New
Headers
Series firmware: imx: scu/scu-irq: misc update |

Commit Message

Peng Fan (OSS) July 31, 2023, 9:04 a.m. UTC
  From: Peng Fan <peng.fan@nxp.com>

For IMX_SC_MISC_FUNC_UNIQUE_ID, the scfw has a return value,
and the imx-scu always return 0. So drop the return value check.

BTW, also initialize msg to 0.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/firmware/imx/imx-scu-soc.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
  

Comments

Shawn Guo Aug. 7, 2023, 2:33 a.m. UTC | #1
On Mon, Jul 31, 2023 at 05:04:43PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> For IMX_SC_MISC_FUNC_UNIQUE_ID, the scfw has a return value,
> and the imx-scu always return 0. So drop the return value check.

imx_scu_call_rpc() could fail for a few reason.  Are we not want to
check those possible failures?

Shawn

> 
> BTW, also initialize msg to 0.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/firmware/imx/imx-scu-soc.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/firmware/imx/imx-scu-soc.c b/drivers/firmware/imx/imx-scu-soc.c
> index 2f32353de2c9..ef9103987e76 100644
> --- a/drivers/firmware/imx/imx-scu-soc.c
> +++ b/drivers/firmware/imx/imx-scu-soc.c
> @@ -33,20 +33,15 @@ struct imx_sc_msg_misc_get_soc_uid {
>  
>  static int imx_scu_soc_uid(u64 *soc_uid)
>  {
> -	struct imx_sc_msg_misc_get_soc_uid msg;
> +	struct imx_sc_msg_misc_get_soc_uid msg = { 0 };
>  	struct imx_sc_rpc_msg *hdr = &msg.hdr;
> -	int ret;
>  
>  	hdr->ver = IMX_SC_RPC_VERSION;
>  	hdr->svc = IMX_SC_RPC_SVC_MISC;
>  	hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID;
>  	hdr->size = 1;
>  
> -	ret = imx_scu_call_rpc(imx_sc_soc_ipc_handle, &msg, true);
> -	if (ret) {
> -		pr_err("%s: get soc uid failed, ret %d\n", __func__, ret);
> -		return ret;
> -	}
> +	imx_scu_call_rpc(imx_sc_soc_ipc_handle, &msg, true);
>  
>  	*soc_uid = msg.uid_high;
>  	*soc_uid <<= 32;
> -- 
> 2.37.1
>
  
Peng Fan Aug. 7, 2023, 3 a.m. UTC | #2
Hi Shawn,

> Subject: Re: [PATCH V5 3/9] firmware: imx: scu: drop return value check
> 
> On Mon, Jul 31, 2023 at 05:04:43PM +0800, Peng Fan (OSS) wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > For IMX_SC_MISC_FUNC_UNIQUE_ID, the scfw has a return value, and the
> > imx-scu always return 0. So drop the return value check.
> 
> imx_scu_call_rpc() could fail for a few reason.  Are we not want to check
> those possible failures?

Yes, I overlooked this, drop this patch.

Thanks,
Peng.

> 
> Shawn
> 
> >
> > BTW, also initialize msg to 0.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >  drivers/firmware/imx/imx-scu-soc.c | 9 ++-------
> >  1 file changed, 2 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/firmware/imx/imx-scu-soc.c
> > b/drivers/firmware/imx/imx-scu-soc.c
> > index 2f32353de2c9..ef9103987e76 100644
> > --- a/drivers/firmware/imx/imx-scu-soc.c
> > +++ b/drivers/firmware/imx/imx-scu-soc.c
> > @@ -33,20 +33,15 @@ struct imx_sc_msg_misc_get_soc_uid {
> >
> >  static int imx_scu_soc_uid(u64 *soc_uid)  {
> > -	struct imx_sc_msg_misc_get_soc_uid msg;
> > +	struct imx_sc_msg_misc_get_soc_uid msg = { 0 };
> >  	struct imx_sc_rpc_msg *hdr = &msg.hdr;
> > -	int ret;
> >
> >  	hdr->ver = IMX_SC_RPC_VERSION;
> >  	hdr->svc = IMX_SC_RPC_SVC_MISC;
> >  	hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID;
> >  	hdr->size = 1;
> >
> > -	ret = imx_scu_call_rpc(imx_sc_soc_ipc_handle, &msg, true);
> > -	if (ret) {
> > -		pr_err("%s: get soc uid failed, ret %d\n", __func__, ret);
> > -		return ret;
> > -	}
> > +	imx_scu_call_rpc(imx_sc_soc_ipc_handle, &msg, true);
> >
> >  	*soc_uid = msg.uid_high;
> >  	*soc_uid <<= 32;
> > --
> > 2.37.1
> >
  

Patch

diff --git a/drivers/firmware/imx/imx-scu-soc.c b/drivers/firmware/imx/imx-scu-soc.c
index 2f32353de2c9..ef9103987e76 100644
--- a/drivers/firmware/imx/imx-scu-soc.c
+++ b/drivers/firmware/imx/imx-scu-soc.c
@@ -33,20 +33,15 @@  struct imx_sc_msg_misc_get_soc_uid {
 
 static int imx_scu_soc_uid(u64 *soc_uid)
 {
-	struct imx_sc_msg_misc_get_soc_uid msg;
+	struct imx_sc_msg_misc_get_soc_uid msg = { 0 };
 	struct imx_sc_rpc_msg *hdr = &msg.hdr;
-	int ret;
 
 	hdr->ver = IMX_SC_RPC_VERSION;
 	hdr->svc = IMX_SC_RPC_SVC_MISC;
 	hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID;
 	hdr->size = 1;
 
-	ret = imx_scu_call_rpc(imx_sc_soc_ipc_handle, &msg, true);
-	if (ret) {
-		pr_err("%s: get soc uid failed, ret %d\n", __func__, ret);
-		return ret;
-	}
+	imx_scu_call_rpc(imx_sc_soc_ipc_handle, &msg, true);
 
 	*soc_uid = msg.uid_high;
 	*soc_uid <<= 32;