]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: phy: ncsi: reslove the unaligned access issue
authorJacky Chou <jacky_chou@aspeedtech.com>
Mon, 5 Feb 2024 08:13:23 +0000 (16:13 +0800)
committerTom Rini <trini@konsulko.com>
Tue, 26 Mar 2024 23:58:26 +0000 (19:58 -0400)
From the ethernet header is not on aligned, because the length
of the ethernet header is 14 bytes.
Therefore, unaligned access must be done here.

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
drivers/net/phy/ncsi.c

index f9069c3a10d7d5bb8775bd5ad8336af6b67b366b..2bca116a9d81808755ff1bf7c3071a9e0a04b3c1 100644 (file)
@@ -286,11 +286,11 @@ static void ncsi_rsp_gc(struct ncsi_rsp_pkt *pkt)
        }
 
        c = &ncsi_priv->packages[np].channels[nc];
-       c->cap_generic = ntohl(gc->cap) & NCSI_CAP_GENERIC_MASK;
-       c->cap_bc = ntohl(gc->bc_cap) & NCSI_CAP_BC_MASK;
-       c->cap_mc = ntohl(gc->mc_cap) & NCSI_CAP_MC_MASK;
-       c->cap_aen = ntohl(gc->aen_cap) & NCSI_CAP_AEN_MASK;
-       c->cap_vlan = ntohl(gc->vlan_mode) & NCSI_CAP_VLAN_MASK;
+       c->cap_generic = get_unaligned_be32(&gc->cap) & NCSI_CAP_GENERIC_MASK;
+       c->cap_bc = get_unaligned_be32(&gc->bc_cap) & NCSI_CAP_BC_MASK;
+       c->cap_mc = get_unaligned_be32(&gc->mc_cap) & NCSI_CAP_MC_MASK;
+       c->cap_aen = get_unaligned_be32(&gc->aen_cap) & NCSI_CAP_AEN_MASK;
+       c->cap_vlan = gc->vlan_mode & NCSI_CAP_VLAN_MASK;
 
        /* End of probe for this channel */
 }