Commit d2c47b62 authored by Josh Hay's avatar Josh Hay Committed by Jeff Kirsher

ixgbe: fix return values and memcpy parameters to eliminate Smatch warnings

This patch removes the rval variable returns from function and replaces
them with direct returns in ixgbe_dcbnl_getnumtcs. It also changes how
ixgbe_gstrings_test is copied into data with memcpy in ixgbe_get_strings
because "*ixgbe_gstrings_test too small (32 vs 160)".
Signed-off-by: default avatarJosh Hay <joshua.a.hay@intel.com>
Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent f752be9c
...@@ -449,7 +449,6 @@ static u8 ixgbe_dcbnl_getcap(struct net_device *netdev, int capid, u8 *cap) ...@@ -449,7 +449,6 @@ static u8 ixgbe_dcbnl_getcap(struct net_device *netdev, int capid, u8 *cap)
static int ixgbe_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num) static int ixgbe_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num)
{ {
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_adapter *adapter = netdev_priv(netdev);
u8 rval = 0;
if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
switch (tcid) { switch (tcid) {
...@@ -460,14 +459,14 @@ static int ixgbe_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num) ...@@ -460,14 +459,14 @@ static int ixgbe_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num)
*num = adapter->dcb_cfg.num_tcs.pfc_tcs; *num = adapter->dcb_cfg.num_tcs.pfc_tcs;
break; break;
default: default:
rval = -EINVAL; return -EINVAL;
break; break;
} }
} else { } else {
rval = -EINVAL; return -EINVAL;
} }
return rval; return 0;
} }
static int ixgbe_dcbnl_setnumtcs(struct net_device *netdev, int tcid, u8 num) static int ixgbe_dcbnl_setnumtcs(struct net_device *netdev, int tcid, u8 num)
......
...@@ -1099,8 +1099,10 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset, ...@@ -1099,8 +1099,10 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,
switch (stringset) { switch (stringset) {
case ETH_SS_TEST: case ETH_SS_TEST:
memcpy(data, *ixgbe_gstrings_test, for (i = 0; i < IXGBE_TEST_LEN; i++) {
IXGBE_TEST_LEN * ETH_GSTRING_LEN); memcpy(data, ixgbe_gstrings_test[i], ETH_GSTRING_LEN);
data += ETH_GSTRING_LEN;
}
break; break;
case ETH_SS_STATS: case ETH_SS_STATS:
for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) { for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment