All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin King <colin.king@canonical.com>
Cc: Christian Lamparter <chunkeey@googlemail.com>,
	Kalle Valo <kvalo@codeaurora.org>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	"John W . Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] carl9170: Fix error return -EAGAIN if not started
Date: Fri, 8 Oct 2021 08:58:54 +0300	[thread overview]
Message-ID: <20211008055854.GE2048@kadam> (raw)
In-Reply-To: <20211008001558.32416-1-colin.king@canonical.com>

On Fri, Oct 08, 2021 at 01:15:58AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> There is an error return path where the error return is being
> assigned to err rather than count and the error exit path does
> not return -EAGAIN as expected. Fix this by setting the error
> return to variable count as this is the value that is returned
> at the end of the function.
> 
> Addresses-Coverity: ("Unused value")
> Fixes: 00c4da27a421 ("carl9170: firmware parser and debugfs code")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/net/wireless/ath/carl9170/debug.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/carl9170/debug.c b/drivers/net/wireless/ath/carl9170/debug.c
> index bb40889d7c72..f163c6bdac8f 100644
> --- a/drivers/net/wireless/ath/carl9170/debug.c
> +++ b/drivers/net/wireless/ath/carl9170/debug.c
> @@ -628,7 +628,7 @@ static ssize_t carl9170_debugfs_bug_write(struct ar9170 *ar, const char *buf,
>  
>  	case 'R':
>  		if (!IS_STARTED(ar)) {
> -			err = -EAGAIN;
> +			count = -EAGAIN;
>  			goto out;

This is ugly.  The bug wouldn't have happened with a direct return, it's
only the goto out which causes it.  Better to replace all the error
paths with direct returns.  There are two other direct returns so it's
not like a new thing...

Goto out on the success path is fine here, though.

regards,
dan carpenter


  reply	other threads:[~2021-10-08  5:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08  0:15 [PATCH] carl9170: Fix error return -EAGAIN if not started Colin King
2021-10-08  5:58 ` Dan Carpenter [this message]
2021-10-08  7:31   ` Colin Ian King
2021-10-08  7:43     ` Dan Carpenter
2021-10-08 15:15     ` Christian Lamparter
2021-10-10  8:05 ` Kalle Valo

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=20211008055854.GE2048@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=chunkeey@googlemail.com \
    --cc=colin.king@canonical.com \
    --cc=davem@davemloft.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.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 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.