DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/2] ethtool: fix dead code
Date: Tue,  8 Dec 2015 08:51:09 -0800	[thread overview]
Message-ID: <1449593469-16954-3-git-send-email-stephen@networkplumber.org> (raw)
In-Reply-To: <1449593469-16954-1-git-send-email-stephen@networkplumber.org>

Remove dead code, and print better return for other errors.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

*** CID 120411:  Control flow issues  (DEADCODE)
/examples/ethtool/ethtool-app/ethapp.c: 484 in pcmd_macaddr_callback()
478     				mac_addr.addr_bytes[4],
479     				mac_addr.addr_bytes[5]);
480     			return;
481     		}
482     	}
483     	if (stat == 0)
>>>     CID 120411:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "return;".
484     		return;
485     	else if (stat == -ENOTSUP)
486     		printf("Port %i: Operation not supported\n", params->port);
487     	else
488     		printf("Port %i: Error %i\n", params->port, stat);
489     }

** CID 120410:  Error handling issues  (CHECKED_RETURN)
---
 examples/ethtool/ethtool-app/ethapp.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c
index 57c584e..3863b02 100644
--- a/examples/ethtool/ethtool-app/ethapp.c
+++ b/examples/ethtool/ethtool-app/ethapp.c
@@ -480,12 +480,9 @@ pcmd_macaddr_callback(void *ptr_params,
 			return;
 		}
 	}
-	if (stat == 0)
-		return;
-	else if (stat == -ENOTSUP)
-		printf("Port %i: Operation not supported\n", params->port);
-	else
-		printf("Port %i: Error %i\n", params->port, stat);
+
+	printf("Port %i: Error %s\n", params->port,
+	       strerror(-stat));
 }
 
 static void
-- 
2.1.4

  parent reply	other threads:[~2015-12-08 16:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 16:51 [dpdk-dev] [PATCH 0/2] Trivial fixes for Coverity warnings Stephen Hemminger
2015-12-08 16:51 ` [dpdk-dev] [PATCH 1/2] ip_pipeline: fix coverity warning Stephen Hemminger
2015-12-08 16:51 ` Stephen Hemminger [this message]
2015-12-08 16:58   ` [dpdk-dev] [PATCH 2/2] ethtool: fix dead code Remy Horton
2015-12-09 20:36     ` Thomas Monjalon

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=1449593469-16954-3-git-send-email-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    /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).