From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Josh Hay <joshua.a.hay@intel.com>,
netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 12/15] ixgbe: fix return values and memcpy parameters to eliminate Smatch warnings
Date: Tue, 5 Feb 2013 02:02:25 -0800 [thread overview]
Message-ID: <1360058548-18158-13-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1360058548-18158-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Josh Hay <joshua.a.hay@intel.com>
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: Josh Hay <joshua.a.hay@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | 7 +++----
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 6 ++++--
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
index c261333..3735590 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
@@ -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)
{
struct ixgbe_adapter *adapter = netdev_priv(netdev);
- u8 rval = 0;
if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
switch (tcid) {
@@ -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;
break;
default:
- rval = -EINVAL;
+ return -EINVAL;
break;
}
} else {
- rval = -EINVAL;
+ return -EINVAL;
}
- return rval;
+ return 0;
}
static int ixgbe_dcbnl_setnumtcs(struct net_device *netdev, int tcid, u8 num)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index bafd141..355ca08 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -1099,8 +1099,10 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,
switch (stringset) {
case ETH_SS_TEST:
- memcpy(data, *ixgbe_gstrings_test,
- IXGBE_TEST_LEN * ETH_GSTRING_LEN);
+ for (i = 0; i < IXGBE_TEST_LEN; i++) {
+ memcpy(data, ixgbe_gstrings_test[i], ETH_GSTRING_LEN);
+ data += ETH_GSTRING_LEN;
+ }
break;
case ETH_SS_STATS:
for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) {
--
1.7.11.7
next prev parent reply other threads:[~2013-02-05 10:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-05 10:02 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2013.02.05 Jeff Kirsher
2013-02-05 10:02 ` [net-next 01/15] e1000e: cosmetic move of #defines and prototypes to the new 82571.h Jeff Kirsher
2013-02-05 10:02 ` [net-next 02/15] e1000e: cosmetic move of #defines to the new 80003es2lan.h Jeff Kirsher
2013-02-05 10:02 ` [net-next 03/15] e1000e: cosmetic move of #defines and prototypes to the new ich8lan.h Jeff Kirsher
2013-02-05 10:02 ` [net-next 04/15] e1000e: cosmetic move of function prototypes to the new mac.h Jeff Kirsher
2013-02-05 10:02 ` [net-next 05/15] e1000e: cosmetic move of #defines and function prototypes to the new phy.h Jeff Kirsher
2013-02-05 10:02 ` [net-next 06/15] e1000e: cosmetic move of #defines and function prototypes to the new nvm.h Jeff Kirsher
2013-02-05 10:02 ` [net-next 07/15] e1000e: cosmetic move of #defines and prototypes to the new manage.h Jeff Kirsher
2013-02-05 10:02 ` [net-next 08/15] e1000e: convert enums of register offsets and move #defines to regs.h Jeff Kirsher
2013-02-05 10:02 ` [net-next 09/15] e1000e: cleanup checkpatch braces checks Jeff Kirsher
2013-02-05 10:02 ` [net-next 10/15] ixgbe: allow reading of SFF-8472 data over i2c Jeff Kirsher
2013-02-05 10:02 ` [net-next 11/15] ixgbe: fix potential null dereference Jeff Kirsher
2013-02-05 10:02 ` Jeff Kirsher [this message]
2013-02-05 10:02 ` [net-next 13/15] ixgbe: update date to 2013 Jeff Kirsher
2013-02-05 10:02 ` [net-next 14/15] ixgbe: Replace rmb in Tx cleanup with read_barrier_depends Jeff Kirsher
2013-02-05 10:02 ` [net-next 15/15] ixgbe: Fix SR-IOV MTU warning Jeff Kirsher
2013-02-05 19:56 ` [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2013.02.05 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1360058548-18158-13-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=gospo@redhat.com \
--cc=joshua.a.hay@intel.com \
--cc=netdev@vger.kernel.org \
--cc=sassmann@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).