From 89243c2929a65dc33ca9318b407aa0fe0e8ffede Mon Sep 17 00:00:00 2001 From: Zdenek Styblik Date: Thu, 9 Feb 2012 12:26:31 +0000 Subject: [PATCH] Feature Requests item #3486218 - remove bloat in 'lib/ipmi_lanp.c' Commit removes bloat code in ipmi_lan_stats_clear() in 'lib/ipmi_lanp.c' and replaces duplicate code with call to is_lan_channel(). --- ipmitool/lib/ipmi_lanp.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/ipmitool/lib/ipmi_lanp.c b/ipmitool/lib/ipmi_lanp.c index d5b6ef7..20e945c 100644 --- a/ipmitool/lib/ipmi_lanp.c +++ b/ipmitool/lib/ipmi_lanp.c @@ -2090,23 +2090,13 @@ ipmi_lan_stats_get(struct ipmi_intf * intf, uint8_t chan) static int ipmi_lan_stats_clear(struct ipmi_intf * intf, uint8_t chan) { - uint8_t medium; int rc = 0; struct ipmi_rs * rsp; struct ipmi_rq req; uint8_t msg_data[2]; - if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX) { - lprintf(LOG_ERR, "Invalid Channel %d", chan); - return -1; - } - - /* find type of channel and only accept 802.3 LAN */ - medium = ipmi_get_channel_medium(intf, chan); - if (medium != IPMI_CHANNEL_MEDIUM_LAN && - medium != IPMI_CHANNEL_MEDIUM_LAN_OTHER) { - lprintf(LOG_ERR, "Channel %d (%s) is not a LAN channel", - chan, val2str(medium, ipmi_channel_medium_vals), medium); + if (!is_lan_channel(intf, chan)) { + lprintf(LOG_ERR, "Channel %d is not a LAN channel", chan); return -1; }