All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tan, Ley Foon <ley.foon.tan@intel.com>
To: u-boot@lists.denx.de
Subject: [PATCH v1 2/5] arm: socfpga: mailbox: Always read mailbox responses before returning status
Date: Fri, 4 Sep 2020 09:39:01 +0000	[thread overview]
Message-ID: <BY5PR11MB389365BC277961E285DEE40ECC2D0@BY5PR11MB3893.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200812015625.40790-3-chee.hong.ang@intel.com>



> -----Original Message-----
> From: Ang, Chee Hong <chee.hong.ang@intel.com>
> Sent: Wednesday, August 12, 2020 9:56 AM
> To: u-boot at lists.denx.de
> Cc: Marek Vasut <marex@denx.de>; Simon Goldschmidt
> <simon.k.r.goldschmidt@gmail.com>; Tom Rini <trini@konsulko.com>; See,
> Chin Liang <chin.liang.see@intel.com>; Tan, Ley Foon
> <ley.foon.tan@intel.com>; Ang, Chee Hong <chee.hong.ang@intel.com>;
> Chee, Tien Fong <tien.fong.chee@intel.com>; Lim, Elly Siew Chin
> <elly.siew.chin.lim@intel.com>
> Subject: [PATCH v1 2/5] arm: socfpga: mailbox: Always read mailbox
> responses before returning status
> 
> Mailbox driver should always check for the length of the response and read
> the response data before returning the response status to caller.
> 
> Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
> ---
>  arch/arm/mach-socfpga/mailbox_s10.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-socfpga/mailbox_s10.c b/arch/arm/mach-
> socfpga/mailbox_s10.c
> index 729d9b04fa..e8a587f007 100644
> --- a/arch/arm/mach-socfpga/mailbox_s10.c
> +++ b/arch/arm/mach-socfpga/mailbox_s10.c
> @@ -221,9 +221,7 @@ static __always_inline int
> mbox_send_cmd_common(u8 id, u32 cmd, u8 is_indirect,
>  			if ((MBOX_RESP_CLIENT_GET(resp) ==
>  			     MBOX_CLIENT_ID_UBOOT) &&
>  			    (MBOX_RESP_ID_GET(resp) == id)) {
> -				ret = MBOX_RESP_ERR_GET(resp);
> -				if (ret)
> -					return ret;
> +				int resp_err = MBOX_RESP_ERR_GET(resp);
> 
>  				if (resp_buf_len) {
>  					buf_len = *resp_buf_len;
> @@ -252,7 +250,7 @@ static __always_inline int
> mbox_send_cmd_common(u8 id, u32 cmd, u8 is_indirect,
>  						buf_len--;
>  					}
>  				}
> -				return ret;
> +				return resp_err;
>  			}
>  		}
>  	};


Reviewed-by: Ley Foon Tan <ley.foon.tan@intel.com>

  reply	other threads:[~2020-09-04  9:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12  1:56 [PATCH v1 0/5] SoCFPGA mailbox driver fixes and enhancements Chee Hong Ang
2020-08-12  1:56 ` [PATCH v1 1/5] arm: socfpga: mailbox: Refactor mailbox timeout event handling Chee Hong Ang
2020-09-04  9:38   ` Tan, Ley Foon
2020-08-12  1:56 ` [PATCH v1 2/5] arm: socfpga: mailbox: Always read mailbox responses before returning status Chee Hong Ang
2020-09-04  9:39   ` Tan, Ley Foon [this message]
2020-08-12  1:56 ` [PATCH v1 3/5] arm: socfpga: mailbox: Support sending large mailbox command Chee Hong Ang
2020-09-04  9:43   ` Tan, Ley Foon
2020-08-12  1:56 ` [PATCH v1 4/5] arm: socfpga: mailbox: Update mailbox response codes Chee Hong Ang
2020-08-12  1:56 ` [PATCH v1 5/5] arm: socfpga: mailbox: Add mailbox retry support Chee Hong Ang

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=BY5PR11MB389365BC277961E285DEE40ECC2D0@BY5PR11MB3893.namprd11.prod.outlook.com \
    --to=ley.foon.tan@intel.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.