diff mbox series

net: phy: ncsi: reslove the unaligned access issue

Message ID 20240205081323.256131-1-jacky_chou@aspeedtech.com
State Accepted
Commit cc09160f30b33ea365e89c445edfb4f3b985911b
Delegated to: Ramon Fried
Headers show
Series net: phy: ncsi: reslove the unaligned access issue | expand

Commit Message

Jacky Chou Feb. 5, 2024, 8:13 a.m. UTC
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 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Tom Rini March 28, 2024, 3:08 p.m. UTC | #1
On Mon, Feb 05, 2024 at 04:13:23PM +0800, Jacky Chou wrote:

> 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>

Applied to u-boot/next, thanks!
Marek Vasut March 28, 2024, 3:57 p.m. UTC | #2
On 3/28/24 4:08 PM, Tom Rini wrote:
> On Mon, Feb 05, 2024 at 04:13:23PM +0800, Jacky Chou wrote:
> 
>>  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>
> 
> Applied to u-boot/next, thanks!

Typo in subject, reslove->resolve .
diff mbox series

Patch

diff --git a/drivers/net/phy/ncsi.c b/drivers/net/phy/ncsi.c
index eb3fd65bb4..04617b7840 100644
--- a/drivers/net/phy/ncsi.c
+++ b/drivers/net/phy/ncsi.c
@@ -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 */
 }