Thread (16 messages) 16 messages, 4 authors, 2024-09-12

Re: [PATCH net-next 2/3] net: ethernet: ti: am65-cpsw: Use __be64 type for id_temp

From: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
Date: 2024-09-10 08:43:05
Also in: linux-omap, llvm

On Tue, Sep 10, 2024 at 12:48 PM Simon Horman [off-list ref] wrote:
The id_temp local variable in am65_cpsw_nuss_probe() is
used to hold a 64-bit big-endian value as it is assigned using
cpu_to_be64().

It is read using memcpy(), where it is written as an identifier into a
byte-array.  So this can also be treated as big endian.

As it's type is currently host byte order (u64), sparse flags
an endian mismatch when compiling for little-endian systems:

.../am65-cpsw-nuss.c:3454:17: warning: incorrect type in assignment (different base types)
.../am65-cpsw-nuss.c:3454:17:    expected unsigned long long [usertype] id_temp
.../am65-cpsw-nuss.c:3454:17:    got restricted __be64 [usertype]

Address this by using __be64 as the type of id_temp.

No functional change intended.
Compile tested only.

Signed-off-by: Simon Horman <horms@kernel.org>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
quoted hunk ↗ jump to hunk
---
 drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index a4b0e4bb7529..9e6353e0361e 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -3444,7 +3444,7 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
        struct resource *res;
        struct clk *clk;
        int ale_entries;
-       u64 id_temp;
+       __be64 id_temp;
        int ret, i;

        common = devm_kzalloc(dev, sizeof(struct am65_cpsw_common), GFP_KERNEL);

--
2.45.2

-- 
Regards,
Kalesh A P

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help