netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Büsch" <m@bues.ch>
To: Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 08/11] ssb: driver_chip_comon_pmu: Fix probable mask then right shift defect
Date: Mon, 27 Oct 2014 18:32:31 +0100	[thread overview]
Message-ID: <20141027183231.2a9abbb4@wiggum> (raw)
In-Reply-To: <e68a49a228d8d2495630b4ef03a1f32b33fce7fe.1414387334.git.joe@perches.com>

[-- Attachment #1: Type: text/plain, Size: 1239 bytes --]

On Sun, 26 Oct 2014 22:25:04 -0700
Joe Perches <joe@perches.com> wrote:

> Precedence of & and >> is not the same and is not left to right.
> shift has higher precedence and should be done after the mask.
> 
> Add parentheses around the mask.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Good catch.

Reviewed-by: Michael Büsch <m@bues.ch>

> ---
>  drivers/ssb/driver_chipcommon_pmu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ssb/driver_chipcommon_pmu.c b/drivers/ssb/driver_chipcommon_pmu.c
> index 1173a09..bc71583 100644
> --- a/drivers/ssb/driver_chipcommon_pmu.c
> +++ b/drivers/ssb/driver_chipcommon_pmu.c
> @@ -621,8 +621,8 @@ static u32 ssb_pmu_get_alp_clock_clk0(struct ssb_chipcommon *cc)
>  	u32 crystalfreq;
>  	const struct pmu0_plltab_entry *e = NULL;
>  
> -	crystalfreq = chipco_read32(cc, SSB_CHIPCO_PMU_CTL) &
> -		      SSB_CHIPCO_PMU_CTL_XTALFREQ >> SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT;
> +	crystalfreq = (chipco_read32(cc, SSB_CHIPCO_PMU_CTL) &
> +		       SSB_CHIPCO_PMU_CTL_XTALFREQ) >> SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT;
>  	e = pmu0_plltab_find_entry(crystalfreq);
>  	BUG_ON(!e);
>  	return e->freq * 1000;




-- 
Michael

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

      reply	other threads:[~2014-10-27 17:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27  5:24 [PATCH 00/11] treewide: mask then shift defects and style updates Joe Perches
2014-10-27  5:25 ` [PATCH 07/11] iwlwifi: dvm: Fix probable mask then right shift defect Joe Perches
2014-10-27  6:14   ` Grumbach, Emmanuel
2014-10-27  5:25 ` [PATCH 08/11] ssb: driver_chip_comon_pmu: " Joe Perches
2014-10-27 17:32   ` Michael Büsch [this message]

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=20141027183231.2a9abbb4@wiggum \
    --to=m@bues.ch \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 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).