linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@codeaurora.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Solomon Peachy <pizza@shaftnet.org>,
	linux-wireless@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v2] cw1200: Fix a signedness bug in cw1200_load_firmware()
Date: Tue, 01 Oct 2019 15:02:35 +0300	[thread overview]
Message-ID: <87a7ak65d0.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <20191001114501.GA6550@mwanda> (Dan Carpenter's message of "Tue, 1 Oct 2019 14:45:01 +0300")

Dan Carpenter <dan.carpenter@oracle.com> writes:

> The "priv->hw_type" is an enum and in this context GCC will treat it
> as an unsigned int so the error handling will never trigger.
>
> Fixes: a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: better style and preserve the error code.
>
>  drivers/net/wireless/st/cw1200/fwio.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/st/cw1200/fwio.c b/drivers/net/wireless/st/cw1200/fwio.c
> index 6574e78e05ea..2a03dc533b6a 100644
> --- a/drivers/net/wireless/st/cw1200/fwio.c
> +++ b/drivers/net/wireless/st/cw1200/fwio.c
> @@ -320,12 +320,12 @@ int cw1200_load_firmware(struct cw1200_common *priv)
>  		goto out;
>  	}
>  
> -	priv->hw_type = cw1200_get_hw_type(val32, &major_revision);
> -	if (priv->hw_type < 0) {
> +	ret = cw1200_get_hw_type(val32, &major_revision);
> +	if (ret < 0) {
>  		pr_err("Can't deduce hardware type.\n");
> -		ret = -ENOTSUPP;
>  		goto out;
>  	}
> +	priv->hw_type = ret;

Thanks, this is indeed much better.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

  reply	other threads:[~2019-10-01 12:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25 10:59 [PATCH] cw1200: Fix a signedness bug in cw1200_load_firmware() Dan Carpenter
2019-09-25 11:06 ` Kalle Valo
2019-10-01 11:45   ` [PATCH v2] " Dan Carpenter
2019-10-01 12:02     ` Kalle Valo [this message]
2019-10-02  4:35     ` 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=87a7ak65d0.fsf@kamboji.qca.qualcomm.com \
    --to=kvalo@codeaurora.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pizza@shaftnet.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).