kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin King <colin.king@canonical.com>
Cc: Oded Gabbay <ogabbay@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] habanalabs/gaudi: remove redundant assignment to variable err
Date: Fri, 4 Jun 2021 11:05:03 +0300	[thread overview]
Message-ID: <20210604080503.GJ1955@kadam> (raw)
In-Reply-To: <20210603131210.84763-1-colin.king@canonical.com>

On Thu, Jun 03, 2021 at 02:12:10PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable err is being assigned a value that is never read, the
> assignment is redundant and can be removed. Also remove some empty
> lines.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/misc/habanalabs/gaudi/gaudi.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c
> index 9e4a6bb3acd1..22f220859b46 100644
> --- a/drivers/misc/habanalabs/gaudi/gaudi.c
> +++ b/drivers/misc/habanalabs/gaudi/gaudi.c
> @@ -7379,9 +7379,6 @@ static int gaudi_hbm_read_interrupts(struct hl_device *hdev, int device,
>  			device, ch, hbm_ecc_data->first_addr, type,
>  			hbm_ecc_data->sec_cont_cnt, hbm_ecc_data->sec_cnt,
>  			hbm_ecc_data->dec_cnt);
> -
> -		err = 1;
> -
>  		return 0;
>  	}

Not related to your patch (which seems fine), but I always feel like
there should be a rule that function which return a mix of negative
error codes and either zero or one on success should have to have
documentation explaining why.

It's impossible to tell from the context here and neither of the callers
check the return.  :P

regards,
dan carpenter


  reply	other threads:[~2021-06-04  8:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 13:12 [PATCH] habanalabs/gaudi: remove redundant assignment to variable err Colin King
2021-06-04  8:05 ` Dan Carpenter [this message]
2021-06-06  8:32   ` 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=20210604080503.GJ1955@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=arnd@arndb.de \
    --cc=colin.king@canonical.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ogabbay@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).