[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <161566984049.1478170.1891806275092209249@swboyd.mtv.corp.google.com>
Date: Sat, 13 Mar 2021 13:10:40 -0800
From: Stephen Boyd <sboyd@...nel.org>
To: Dinh Nguyen <dinguyen@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
Michael Turquette <mturquette@...libre.com>,
linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Arnd Bergmann <arnd@...db.de>,
Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
Subject: Re: [PATCH] clk: socfpga: fix iomem pointer cast on 64-bit
Quoting Krzysztof Kozlowski (2021-03-11 06:48:33)
> Pointers should be cast to unsigned long instead of integer. This fixes
> warning when compile testing on ARM64:
>
> drivers/clk/socfpga/clk-gate.c: In function ‘socfpga_clk_recalc_rate’:
> drivers/clk/socfpga/clk-gate.c:102:7: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
Any Fixes tag?
> ---
> drivers/clk/socfpga/clk-gate.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c
> index 43ecd507bf83..c876523d5d51 100644
> --- a/drivers/clk/socfpga/clk-gate.c
> +++ b/drivers/clk/socfpga/clk-gate.c
> @@ -99,7 +99,7 @@ static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk,
> val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift;
> val &= GENMASK(socfpgaclk->width - 1, 0);
> /* Check for GPIO_DB_CLK by its offset */
> - if ((int) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET)
> + if ((unsigned long) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET)
Should it be uintptr_t casted instead? This isn't a very great code
pattern given the way we store information in the iomem pointer about
which clk type it is and then have to cast the pointer and assume
alignment. Would be nice to get rid of it but I understand.
> div = val + 1;
> else
> div = (1 << val);
Powered by blists - more mailing lists