public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Marco Pagani <marpagan@redhat.com>
Cc: Oded Gabbay <ogabbay@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Tom Rix <trix@redhat.com>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] habanalabs: added return value check for hl_fw_dynamic_send_clear_cmd()
Date: Wed, 16 Nov 2022 16:17:37 +0100	[thread overview]
Message-ID: <Y3T/ESXEb+MF2QEW@kroah.com> (raw)
In-Reply-To: <20221116134126.199087-1-marpagan@redhat.com>

On Wed, Nov 16, 2022 at 02:41:25PM +0100, Marco Pagani wrote:
> The clang-analyzer reported a warning: "Value stored to 'rc' is never
> read".
> 
> The return value check for the first hl_fw_dynamic_send_clear_cmd() call
> in hl_fw_dynamic_send_protocol_cmd() appears to be missing.
> 
> Signed-off-by: Marco Pagani <marpagan@redhat.com>
> ---
>  drivers/misc/habanalabs/common/firmware_if.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/misc/habanalabs/common/firmware_if.c b/drivers/misc/habanalabs/common/firmware_if.c
> index 2de6a9bd564d..311942108dbc 100644
> --- a/drivers/misc/habanalabs/common/firmware_if.c
> +++ b/drivers/misc/habanalabs/common/firmware_if.c
> @@ -1782,6 +1782,8 @@ int hl_fw_dynamic_send_protocol_cmd(struct hl_device *hdev,
>  
>  	/* first send clear command to clean former commands */
>  	rc = hl_fw_dynamic_send_clear_cmd(hdev, fw_loader);
> +	if (rc)
> +		return rc;
>  
>  	/* send the actual command */
>  	hl_fw_dynamic_send_cmd(hdev, fw_loader, cmd, size);

Are you sure this is ok?  If the first "clean the buffer" command fails,
all should still be good as that wasn't the real command.

But maybe the hardware will never fail this?

thanks,

greg k-h

  reply	other threads:[~2022-11-16 15:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 13:41 [PATCH] habanalabs: added return value check for hl_fw_dynamic_send_clear_cmd() Marco Pagani
2022-11-16 15:17 ` Greg Kroah-Hartman [this message]
2022-11-17  8:45   ` Oded Gabbay

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=Y3T/ESXEb+MF2QEW@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=marpagan@redhat.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=ogabbay@kernel.org \
    --cc=trix@redhat.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