[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZGcs1sdy0RTrwNby@corigine.com>
Date: Fri, 19 May 2023 10:01:26 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Min-Hua Chen <minhuadotchen@...il.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
netdev@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: stmmac: use le32_to_cpu for p->des0 and p->des1
On Fri, May 19, 2023 at 08:25:21AM +0800, Min-Hua Chen wrote:
> Use le32_to_cpu for p->des0 and p->des1 to fix the
> following sparse warnings:
>
> drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c:110:23: sparse: warning: restricted __le32 degrades to integer
> drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c:110:50: sparse: warning: restricted __le32 degrades to integer
>
> Signed-off-by: Min-Hua Chen <minhuadotchen@...il.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
> index 13c347ee8be9..3d094d83e975 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
> @@ -107,7 +107,8 @@ static int dwxgmac2_rx_check_timestamp(void *desc)
> ts_valid = !(rdes3 & XGMAC_RDES3_TSD) && (rdes3 & XGMAC_RDES3_TSA);
>
> if (likely(desc_valid && ts_valid)) {
> - if ((p->des0 == 0xffffffff) && (p->des1 == 0xffffffff))
> + if ((le32_to_cpu(p->des0) == 0xffffffff) &&
> + (le32_to_cpu(p->des1) == 0xffffffff))
Hi Min-Hua Chen,
I'm not sure if it makes a meaningful difference in practice - and
certainly it won't on LE systems. But I wonder if it's nicer to do the
conversion on the constant rather than the variable part of the comparison.
if ((p->des0 == cpu_to_le32(0xffffffff)) &&
(p->des1 == cpu_to_le32(0xffffffff)))
> return -EINVAL;
> return 0;
> }
> --
> 2.34.1
>
>
Powered by blists - more mailing lists