mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
To: Stephen Boyd <sboyd@kernel.org>,
	Dinh Nguyen <dinguyen@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH] clk: socfpga: fix iomem pointer cast on 64-bit
Date: Sun, 14 Mar 2021 12:04:31 +0100	[thread overview]
Message-ID: <7943a259-d40c-4191-1d0d-461edfc3a218@canonical.com> (raw)
In-Reply-To: <161566984049.1478170.1891806275092209249@swboyd.mtv.corp.google.com>

On 13/03/2021 22:10, Stephen Boyd wrote:
> 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@canonical.com>
> 
> Any Fixes tag?

I'll add it.

> 
>> ---
>>  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?

Good point, thanks!

> his 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.

Best regards,
Krzysztof

      reply	other threads:[~2021-03-14 11:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 14:48 Krzysztof Kozlowski
2021-03-11 16:03 ` Dinh Nguyen
2021-03-13 21:10 ` Stephen Boyd
2021-03-14 11:04   ` Krzysztof Kozlowski [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=7943a259-d40c-4191-1d0d-461edfc3a218@canonical.com \
    --to=krzysztof.kozlowski@canonical.com \
    --cc=arnd@arndb.de \
    --cc=dinguyen@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@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

all inboxes | Powered by JetHome®