devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] net/fec: "u32" is more explicit than "unsigned long"
@ 2013-08-23  9:49 Dan Carpenter
  2013-08-23 12:44 ` Ben Hutchings
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Carpenter @ 2013-08-23  9:49 UTC (permalink / raw)
  To: Grant Likely
  Cc: Rob Herring, David S. Miller, Fabio Estevam, Frank Li, Jim Baxter,
	Fugang Duan, netdev, devicetree, kernel-janitors

tmpaddr[] is a six byte array.  We want to set the first four bytes on
the first line and the remaining two on the next line.  The code assumes
that "unsigned long" is 32 bits and obviously that's not true on 64 bit
arches.  It's better to just use u32 instead.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This is a static checker thing and I can't compile this file.

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index fdf9307..422b125 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1100,9 +1100,9 @@ static void fec_get_mac(struct net_device *ndev)
 	 * 4) FEC mac registers set by bootloader
 	 */
 	if (!is_valid_ether_addr(iap)) {
-		*((unsigned long *) &tmpaddr[0]) =
+		*((u32 *) &tmpaddr[0]) =
 			be32_to_cpu(readl(fep->hwp + FEC_ADDR_LOW));
-		*((unsigned short *) &tmpaddr[4]) =
+		*((u16 *) &tmpaddr[4]) =
 			be16_to_cpu(readl(fep->hwp + FEC_ADDR_HIGH) >> 16);
 		iap = &tmpaddr[0];
 	}

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-08-30 21:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-23  9:49 [patch] net/fec: "u32" is more explicit than "unsigned long" Dan Carpenter
2013-08-23 12:44 ` Ben Hutchings
2013-08-27 18:51   ` David Miller
2013-08-27 18:59     ` Dan Carpenter
2013-08-29  8:25   ` [patch v2] net/fec: cleanup types in fec_get_mac() Dan Carpenter
2013-08-29 18:48     ` Ben Hutchings
2013-08-30  2:02       ` Duan Fugang-B38611
2013-08-30  9:00         ` Dan Carpenter
2013-08-30 21:54     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).