From: Ray Jui <rjui@broadcom.com>
To: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@codeaurora.org>,
Dan Carpenter <dan.carpenter@oracle.com>
Cc: <linux-clk@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
Scott Branden <sbranden@broadcom.com>,
<linux-kernel@vger.kernel.org>,
<bcm-kernel-feedback-list@broadcom.com>
Subject: Re: [PATCH 2/2] clk: iproc: fix bit manipulation arithmetic
Date: Mon, 29 Jun 2015 14:33:32 -0700 [thread overview]
Message-ID: <5591B9AC.7060003@broadcom.com> (raw)
In-Reply-To: <1435613410-18698-3-git-send-email-rjui@broadcom.com>
+ Michael's new email
On 6/29/2015 2:30 PM, Ray Jui wrote:
> A 32-bit variable should be type casted to 64-bit before arithmetic
> operation and assigning it to a 64-bit variable
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Ray Jui <rjui@broadcom.com>
> ---
> drivers/clk/bcm/clk-iproc-pll.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c
> index a8d971b..2dda4e8 100644
> --- a/drivers/clk/bcm/clk-iproc-pll.c
> +++ b/drivers/clk/bcm/clk-iproc-pll.c
> @@ -366,7 +366,7 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw,
> val = readl(pll->pll_base + ctrl->ndiv_int.offset);
> ndiv_int = (val >> ctrl->ndiv_int.shift) &
> bit_mask(ctrl->ndiv_int.width);
> - ndiv = ndiv_int << ctrl->ndiv_int.shift;
> + ndiv = (u64)ndiv_int << ctrl->ndiv_int.shift;
>
> if (ctrl->flags & IPROC_CLK_PLL_HAS_NDIV_FRAC) {
> val = readl(pll->pll_base + ctrl->ndiv_frac.offset);
> @@ -374,7 +374,8 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw,
> bit_mask(ctrl->ndiv_frac.width);
>
> if (ndiv_frac != 0)
> - ndiv = (ndiv_int << ctrl->ndiv_int.shift) | ndiv_frac;
> + ndiv = ((u64)ndiv_int << ctrl->ndiv_int.shift) |
> + ndiv_frac;
> }
>
> val = readl(pll->pll_base + ctrl->pdiv.offset);
>
WARNING: multiple messages have this Message-ID (diff)
From: rjui@broadcom.com (Ray Jui)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] clk: iproc: fix bit manipulation arithmetic
Date: Mon, 29 Jun 2015 14:33:32 -0700 [thread overview]
Message-ID: <5591B9AC.7060003@broadcom.com> (raw)
In-Reply-To: <1435613410-18698-3-git-send-email-rjui@broadcom.com>
+ Michael's new email
On 6/29/2015 2:30 PM, Ray Jui wrote:
> A 32-bit variable should be type casted to 64-bit before arithmetic
> operation and assigning it to a 64-bit variable
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Ray Jui <rjui@broadcom.com>
> ---
> drivers/clk/bcm/clk-iproc-pll.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c
> index a8d971b..2dda4e8 100644
> --- a/drivers/clk/bcm/clk-iproc-pll.c
> +++ b/drivers/clk/bcm/clk-iproc-pll.c
> @@ -366,7 +366,7 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw,
> val = readl(pll->pll_base + ctrl->ndiv_int.offset);
> ndiv_int = (val >> ctrl->ndiv_int.shift) &
> bit_mask(ctrl->ndiv_int.width);
> - ndiv = ndiv_int << ctrl->ndiv_int.shift;
> + ndiv = (u64)ndiv_int << ctrl->ndiv_int.shift;
>
> if (ctrl->flags & IPROC_CLK_PLL_HAS_NDIV_FRAC) {
> val = readl(pll->pll_base + ctrl->ndiv_frac.offset);
> @@ -374,7 +374,8 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw,
> bit_mask(ctrl->ndiv_frac.width);
>
> if (ndiv_frac != 0)
> - ndiv = (ndiv_int << ctrl->ndiv_int.shift) | ndiv_frac;
> + ndiv = ((u64)ndiv_int << ctrl->ndiv_int.shift) |
> + ndiv_frac;
> }
>
> val = readl(pll->pll_base + ctrl->pdiv.offset);
>
next prev parent reply other threads:[~2015-06-29 21:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-29 21:30 [PATCH 0/2] iProc clock driver fixes Ray Jui
2015-06-29 21:30 ` Ray Jui
2015-06-29 21:30 ` [PATCH 1/2] clk: iproc: fix memory leak from clock name Ray Jui
2015-06-29 21:30 ` Ray Jui
2015-06-29 21:33 ` Ray Jui
2015-06-29 21:33 ` Ray Jui
2015-06-29 21:30 ` [PATCH 2/2] clk: iproc: fix bit manipulation arithmetic Ray Jui
2015-06-29 21:30 ` Ray Jui
2015-06-29 21:33 ` Ray Jui [this message]
2015-06-29 21:33 ` Ray Jui
2015-06-29 21:32 ` [PATCH 0/2] iProc clock driver fixes Ray Jui
2015-06-29 21:32 ` Ray Jui
2015-07-02 16:56 ` Stephen Boyd
2015-07-02 16:56 ` Stephen Boyd
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=5591B9AC.7060003@broadcom.com \
--to=rjui@broadcom.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@codeaurora.org \
--cc=sbranden@broadcom.com \
/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.