aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/ti
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2016-09-02 10:22:48 -0400
committerDavid S. Miller <davem@davemloft.net>2016-09-04 14:47:20 -0400
commit2f5281ba2a8feaf6f0aee93356f350855bb530fc (patch)
treefd663e5d4712ee8377677c80bb96167bf72465e9 /drivers/net/ethernet/ti
parent661dbeb9d6e6e698d469c334527eae8177810b1f (diff)
net: ti: cpmac: Fix compiler warning due to type confusion
cpmac_start_xmit() used the max() macro on skb->len (an unsigned int) and ETH_ZLEN (a signed int literal). This led to the following compiler warning: In file included from include/linux/list.h:8:0, from include/linux/module.h:9, from drivers/net/ethernet/ti/cpmac.c:19: drivers/net/ethernet/ti/cpmac.c: In function 'cpmac_start_xmit': include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast (void) (&_max1 == &_max2); \ ^ drivers/net/ethernet/ti/cpmac.c:560:8: note: in expansion of macro 'max' len = max(skb->len, ETH_ZLEN); ^ On top of this, it assigned the result of the max() macro to a signed integer whilst all further uses of it result in it being cast to varying widths of unsigned integer. Fix this up by using max_t to ensure the comparison is performed as unsigned integers, and for consistency change the type of the len variable to unsigned int. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ti')
-rw-r--r--drivers/net/ethernet/ti/cpmac.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index d300d536d06f..fa0cfda24fd9 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -546,7 +546,8 @@ fatal_error:
546 546
547static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev) 547static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
548{ 548{
549 int queue, len; 549 int queue;
550 unsigned int len;
550 struct cpmac_desc *desc; 551 struct cpmac_desc *desc;
551 struct cpmac_priv *priv = netdev_priv(dev); 552 struct cpmac_priv *priv = netdev_priv(dev);
552 553
@@ -556,7 +557,7 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
556 if (unlikely(skb_padto(skb, ETH_ZLEN))) 557 if (unlikely(skb_padto(skb, ETH_ZLEN)))
557 return NETDEV_TX_OK; 558 return NETDEV_TX_OK;
558 559
559 len = max(skb->len, ETH_ZLEN); 560 len = max_t(unsigned int, skb->len, ETH_ZLEN);
560 queue = skb_get_queue_mapping(skb); 561 queue = skb_get_queue_mapping(skb);
561 netif_stop_subqueue(dev, queue); 562 netif_stop_subqueue(dev, queue);
562 563