public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Cristian Marussi <cristian.marussi@arm.com>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] firmware: arm_scmi: Avoid multiple initialisations of hdr->protocol_id
Date: Tue, 8 Jun 2021 15:56:11 +0100	[thread overview]
Message-ID: <20210608145611.GA35368@e120937-lin> (raw)
In-Reply-To: <20210608140140.2042257-1-sudeep.holla@arm.com>

Hi,

On Tue, Jun 08, 2021 at 03:01:40PM +0100, Sudeep Holla wrote:
> Since the hdr->protocol_id is set from the scmi_protocol_instance handle
> just before the transfer, there is no need to initialise the same in
> scmi_xfer_get_init. Remove the unnecessary initialisations.
> 
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/firmware/arm_scmi/driver.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> index 80010d3f5975..1b446d076b12 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c
> @@ -432,9 +432,9 @@ static int do_xfer(const struct scmi_protocol_handle *ph,
>  	struct scmi_chan_info *cinfo;
>  
>  	/*
> -	 * Re-instate protocol id here from protocol handle so that cannot be
> +	 * Initialise protocol id now from protocol handle to avoid it being
>  	 * overridden by mistake (or malice) by the protocol code mangling with
> -	 * the scmi_xfer structure.
> +	 * the scmi_xfer structure prior to this.
>  	 */
>  	xfer->hdr.protocol_id = pi->proto->id;
>  	reinit_completion(&xfer->done);
> @@ -512,8 +512,6 @@ static int do_xfer_with_response(const struct scmi_protocol_handle *ph,
>  	const struct scmi_protocol_instance *pi = ph_to_pi(ph);

This stale unused pi now causing a Warning.

>  	DECLARE_COMPLETION_ONSTACK(async_response);
>  
> -	xfer->hdr.protocol_id = pi->proto->id;
> -
>  	xfer->async_done = &async_response;
>  
>  	ret = do_xfer(ph, xfer);
> @@ -569,7 +567,6 @@ static int xfer_get_init(const struct scmi_protocol_handle *ph,
>  	xfer->tx.len = tx_size;
>  	xfer->rx.len = rx_size ? : info->desc->max_msg_size;
>  	xfer->hdr.id = msg_id;
> -	xfer->hdr.protocol_id = pi->proto->id;
>  	xfer->hdr.poll_completion = false;
>  
>  	*p = xfer;

LGTM, other that the warning above, and tested fine too.

Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Tested-by: Cristian Marussi <cristian.marussi@arm.com>

Thanks,
Cristian

> -- 
> 2.25.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-06-08 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 14:01 [PATCH] firmware: arm_scmi: Avoid multiple initialisations of hdr->protocol_id Sudeep Holla
2021-06-08 14:56 ` Cristian Marussi [this message]
2021-06-09 20:47 ` Sudeep Holla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210608145611.GA35368@e120937-lin \
    --to=cristian.marussi@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox