lkml.org 
[lkml]   [2023]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] net: stmmac: compare p->des0 and p->des1 with __le32 type values
On Fri, May 19, 2023 at 07:25:08PM +0800, Min-Hua Chen wrote:
> Use cpu_to_le32 to convert the constants to __le32 type
> before comparing them with p->des0 and p->des1 (they are __le32 type)
> and to fix 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@gmail.com>

Reviewed-by: Simon Horman <simon.horman@corigine.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..eefbeea04964 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 ((p->des0 == cpu_to_le32(0xffffffff)) &&
> + (p->des1 == cpu_to_le32(0xffffffff)))

nit: Sorry for not noticing this in v1.
There are unnecessary parentheses (both before and after this change).

\
 
 \ /
  Last update: 2023-05-19 13:41    [W:0.037 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site