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

Signed-off-by: Stephen Hemminger <stephen at 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

Reply via email to