summaryrefslogtreecommitdiffstats
path: root/include/uapi/linux/ethtool.h
diff options
context:
space:
mode:
authorJesse Brandeburg2016-10-14 01:13:55 +0200
committerDavid S. Miller2016-10-14 22:05:42 +0200
commit85a624403c77c3f074931aefdfced59f61b668cb (patch)
tree97d6f017863272b5f2e8c84129a8c55f31c8c03c /include/uapi/linux/ethtool.h
parentnet/mlx4_en: fixup xdp tx irq to match rx (diff)
downloadkernel-qcow2-linux-85a624403c77c3f074931aefdfced59f61b668cb.tar.gz
kernel-qcow2-linux-85a624403c77c3f074931aefdfced59f61b668cb.tar.xz
kernel-qcow2-linux-85a624403c77c3f074931aefdfced59f61b668cb.zip
ethtool: silence warning on bit loss
Sparse was complaining when we went to prototype some code using ethtool_cmd_speed_set and SPEED_100000, which uses the upper 16 bits of __u32 speed for the first time. CHECK ... .../uapi/linux/ethtool.h:123:28: warning: cast truncates bits from constant value (186a0 becomes 86a0) The warning is actually bogus, as no bits are really lost, but we can get rid of the sparse warning with this one small change. Reported-by: Preethi Banala <preethi.banala@intel.com> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/uapi/linux/ethtool.h')
-rw-r--r--include/uapi/linux/ethtool.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 099a4200732c..8e547231c1b7 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -119,8 +119,7 @@ struct ethtool_cmd {
static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
__u32 speed)
{
-
- ep->speed = (__u16)speed;
+ ep->speed = (__u16)(speed & 0xFFFF);
ep->speed_hi = (__u16)(speed >> 16);
}