From: walter harms <wharms@bfs.de>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] staging: pi433: fix a precedence bug
Date: Wed, 19 Jul 2017 10:11:29 +0000 [thread overview]
Message-ID: <596F3051.4020100@bfs.de> (raw)
In-Reply-To: <20170719095157.3e2rnskjqbva2kwo@mwanda>
Am 19.07.2017 11:51, schrieb Dan Carpenter:
> We had intended to do the mask first and then the shift. Shift has
> higher precedence so we need to add parenthesis.
>
> Fixes: 874bcba65f9a ("staging: pi433: New driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
> index e391ce777bc7..5089449bf775 100644
> --- a/drivers/staging/pi433/rf69.c
> +++ b/drivers/staging/pi433/rf69.c
> @@ -387,7 +387,7 @@ enum lnaGain rf69_get_lna_gain(struct spi_device *spi)
>
> currentValue = READ_REG(REG_LNA);
is currentValue used again later ?
iff not (IMHO) it would be more readable to use
currentValue &= MASK_LNA_CURRENT_GAIN
here.
and
currentValue >>3
inside the switch()
>
> - switch (currentValue & MASK_LNA_CURRENT_GAIN >> 3) // improvement: change 3 to define
> + switch ((currentValue & MASK_LNA_CURRENT_GAIN) >> 3) // improvement: change 3 to define
> {
> case LNA_GAIN_AUTO: return automatic;
> case LNA_GAIN_MAX: return max;
note:
and instead to add an artificial define for 3, it would be simpler to change the LNA_GAIN_AUTO/MAX
to the "real" values and drop the >>3 for good.
just my 2 cents,
re,
wh
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2017-07-19 10:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 9:51 [PATCH] staging: pi433: fix a precedence bug Dan Carpenter
2017-07-19 10:11 ` walter harms [this message]
2017-07-19 10:26 ` Dan Carpenter
2017-07-19 17:45 ` Marcus Wolf
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=596F3051.4020100@bfs.de \
--to=wharms@bfs.de \
--cc=kernel-janitors@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.