[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <d7c9b9b4-4ee8-4754-b32f-e3205daf47b3@app.fastmail.com>
Date: Mon, 24 Oct 2022 21:55:31 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: "Geert Uytterhoeven" <geert@...ux-m68k.org>,
"kernel test robot" <lkp@...el.com>
Cc: "Yoshihiro Shimoda" <yoshihiro.shimoda.uh@...esas.com>,
"David S . Miller" <davem@...emloft.net>,
"Eric Dumazet" <edumazet@...gle.com>,
"Jakub Kicinski" <kuba@...nel.org>,
"Paolo Abeni" <pabeni@...hat.com>,
"Rob Herring" <robh+dt@...nel.org>,
krzysztof.kozlowski+dt@...aro.org, kbuild-all@...ts.01.org,
Netdev <netdev@...r.kernel.org>, devicetree@...r.kernel.org,
Linux-Renesas <linux-renesas-soc@...r.kernel.org>
Subject: Re: [PATCH v4 2/3] net: ethernet: renesas: Add Ethernet Switch driver
On Mon, Oct 24, 2022, at 17:27, Geert Uytterhoeven wrote:
> On Wed, Oct 19, 2022 at 1:17 PM kernel test robot <lkp@...el.com> wrote:
>> drivers/net/ethernet/renesas/rswitch.c: In function 'rswitch_ext_desc_get_dptr':
>> >> drivers/net/ethernet/renesas/rswitch.c:355:71: warning: left shift count >= width of type [-Wshift-count-overflow]
>> 355 | return __le32_to_cpu(desc->dptrl) | (dma_addr_t)(desc->dptrh) << 32;
>> | ^~
>> drivers/net/ethernet/renesas/rswitch.c: In function 'rswitch_ext_ts_desc_get_dptr':
>> drivers/net/ethernet/renesas/rswitch.c:367:71: warning: left shift count >= width of type [-Wshift-count-overflow]
>> 367 | return __le32_to_cpu(desc->dptrl) | (dma_addr_t)(desc->dptrh) << 32;
>> | ^~
>>
>>
>> vim +355 drivers/net/ethernet/renesas/rswitch.c
>>
>> 352
>> 353 static dma_addr_t rswitch_ext_desc_get_dptr(struct rswitch_ext_desc *desc)
>> 354 {
>> > 355 return __le32_to_cpu(desc->dptrl) | (dma_addr_t)(desc->dptrh) << 32;
>
> A simple fix would be to replace the cast to "dma_addr_t" by a cast to "u64".
> A more convoluted fix would be:
>
> dma_addr_t dma;
>
> dma = __le32_to_cpu(desc->dptrl);
> if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT))
> dma |= (u64)desc->dptrh << 32;
> return dma;
>
> Looking at the gcc compiler output, the both cases are optimized to the
> exact same code, for both arm32 and arm64, so I'd go for the simple fix.
>
> BTW, if struct rswitch_ext_desc would just extend struct rswitch_desc,
> you could use rswitch_ext_desc_get_dptr() for both.
>
Regardless of which way this is expressed, it looked like there is
a missing __le32_to_cpu() around the high word.
Arnd
Powered by blists - more mailing lists