Skip to content

Commit 7d7628f

Browse files
Dan Carpenterdavem330
authored andcommitted
net/fec: cleanup types in fec_get_mac()
My static checker complains that on some arches unsigned longs can be 8 characters which is larger than the buffer is only 6 chars. Additionally, Ben Hutchings points out that the buffer actually holds big endian data and the buffer we are reading from is CPU endian. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f91b29f commit 7d7628f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,10 +1099,10 @@ static void fec_get_mac(struct net_device *ndev)
10991099
* 4) FEC mac registers set by bootloader
11001100
*/
11011101
if (!is_valid_ether_addr(iap)) {
1102-
*((unsigned long *) &tmpaddr[0]) =
1103-
be32_to_cpu(readl(fep->hwp + FEC_ADDR_LOW));
1104-
*((unsigned short *) &tmpaddr[4]) =
1105-
be16_to_cpu(readl(fep->hwp + FEC_ADDR_HIGH) >> 16);
1102+
*((__be32 *) &tmpaddr[0]) =
1103+
cpu_to_be32(readl(fep->hwp + FEC_ADDR_LOW));
1104+
*((__be16 *) &tmpaddr[4]) =
1105+
cpu_to_be16(readl(fep->hwp + FEC_ADDR_HIGH) >> 16);
11061106
iap = &tmpaddr[0];
11071107
}
11081108

0 commit comments

Comments
 (0)