From: "Arnd Bergmann" <arnd@arndb.de>
To: "Geert Uytterhoeven" <geert@linux-m68k.org>,
"kernel test robot" <lkp@intel.com>
Cc: "Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
"David S . Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Rob Herring" <robh+dt@kernel.org>,
krzysztof.kozlowski+dt@linaro.org, kbuild-all@lists.01.org,
Netdev <netdev@vger.kernel.org>,
devicetree@vger.kernel.org,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH v4 2/3] net: ethernet: renesas: Add Ethernet Switch driver
Date: Mon, 24 Oct 2022 21:55:31 +0200 [thread overview]
Message-ID: <d7c9b9b4-4ee8-4754-b32f-e3205daf47b3@app.fastmail.com> (raw)
In-Reply-To: <CAMuHMdXBT2cEqfy00u+0VB=cRUAtrgH9LD26gXgavdvmQyN+pQ@mail.gmail.com>
On Mon, Oct 24, 2022, at 17:27, Geert Uytterhoeven wrote:
> On Wed, Oct 19, 2022 at 1:17 PM kernel test robot <lkp@intel.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
next prev parent reply other threads:[~2022-10-24 21:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-19 8:35 [PATCH v4 0/3] net: ethernet: renesas: Add Ethernet Switch driver Yoshihiro Shimoda
2022-10-19 8:35 ` [PATCH v4 1/3] dt-bindings: net: renesas: Document Renesas Ethernet Switch Yoshihiro Shimoda
2022-10-19 12:37 ` Krzysztof Kozlowski
2022-10-20 1:31 ` Yoshihiro Shimoda
2022-10-20 12:30 ` Krzysztof Kozlowski
2022-10-19 8:35 ` [PATCH v4 2/3] net: ethernet: renesas: Add Ethernet Switch driver Yoshihiro Shimoda
2022-10-19 10:28 ` kernel test robot
2022-10-24 15:27 ` Geert Uytterhoeven
2022-10-24 19:55 ` Arnd Bergmann [this message]
2022-10-24 20:35 ` Geert Uytterhoeven
2022-10-24 20:47 ` Arnd Bergmann
2022-10-25 4:39 ` Yoshihiro Shimoda
2022-10-25 6:48 ` Geert Uytterhoeven
2022-10-25 11:24 ` Yoshihiro Shimoda
2022-10-20 2:23 ` Florian Fainelli
2022-10-20 7:35 ` Yoshihiro Shimoda
2022-10-20 14:11 ` Andrew Lunn
2022-10-24 23:04 ` Florian Fainelli
2022-10-20 20:26 ` kernel test robot
2022-10-19 8:35 ` [PATCH v4 3/3] net: ethernet: renesas: rswitch: Add R-Car Gen4 gPTP support Yoshihiro Shimoda
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=d7c9b9b4-4ee8-4754-b32f-e3205daf47b3@app.fastmail.com \
--to=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=geert@linux-m68k.org \
--cc=kbuild-all@lists.01.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=lkp@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh+dt@kernel.org \
--cc=yoshihiro.shimoda.uh@renesas.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 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).