From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 4A06CA0679 for ; Thu, 28 Mar 2019 16:56:13 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 365AC1B39B; Thu, 28 Mar 2019 16:56:12 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 3720758F6 for ; Thu, 28 Mar 2019 16:56:09 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2019 08:56:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,280,1549958400"; d="scan'208";a="156081819" Received: from lkrakowx-mobl.ger.corp.intel.com ([10.104.12.190]) by fmsmga002.fm.intel.com with ESMTP; 28 Mar 2019 08:56:07 -0700 From: Lukasz Krakowiak To: david.hunt@intel.com Cc: dev@dpdk.org, Lukasz Krakowiak Date: Thu, 28 Mar 2019 16:55:07 +0100 Message-Id: <20190328155507.3608-1-lukaszx.krakowiak@intel.com> X-Mailer: git-send-email 2.19.2.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] power: update for error handling X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190328155507.W-QHT1pZ3BxqqSXN26YzOVgLM1d9ncVFUKf0-5mJ3uQ@z> Update for handling negative returned status from functions call. Signed-off-by: Lukasz Krakowiak --- examples/vm_power_manager/channel_manager.c | 4 ++-- examples/vm_power_manager/channel_monitor.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c index de1a86891..09bfa5c0d 100644 --- a/examples/vm_power_manager/channel_manager.c +++ b/examples/vm_power_manager/channel_manager.c @@ -224,7 +224,7 @@ open_non_blocking_channel(struct channel_info *info) struct timeval tv; info->fd = socket(AF_UNIX, SOCK_STREAM, 0); - if (info->fd == -1) { + if (info->fd < 0) { RTE_LOG(ERR, CHANNEL_MANAGER, "Error(%s) creating socket for '%s'\n", strerror(errno), info->channel_path); @@ -285,7 +285,7 @@ open_host_channel(struct channel_info *info) int flags; info->fd = open(info->channel_path, O_RDWR | O_RSYNC); - if (info->fd == -1) { + if (info->fd < 0) { RTE_LOG(ERR, CHANNEL_MANAGER, "Error(%s) opening fifo for '%s'\n", strerror(errno), info->channel_path); diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c index 1a3a0fa76..22f2eb819 100644 --- a/examples/vm_power_manager/channel_monitor.c +++ b/examples/vm_power_manager/channel_monitor.c @@ -435,7 +435,7 @@ update_policy(struct channel_packet *pkt) /* Copy the contents of *pkt into the policy.pkt */ policies[i].pkt = *pkt; get_pcpu_to_control(&policies[i]); - if (get_pfid(&policies[i]) == -1) { + if (get_pfid(&policies[i]) < 0) { updated = 1; break; } @@ -449,7 +449,7 @@ update_policy(struct channel_packet *pkt) if (policies[i].enabled == 0) { policies[i].pkt = *pkt; get_pcpu_to_control(&policies[i]); - if (get_pfid(&policies[i]) == -1) + if (get_pfid(&policies[i]) < 0) break; core_share_status(i); policies[i].enabled = 1; @@ -756,7 +756,7 @@ read_binary_packet(struct channel_info *chan_info) buffer, buffer_len); if (n_bytes == buffer_len) break; - if (n_bytes == -1) { + if (n_bytes < 0) { err = errno; RTE_LOG(DEBUG, CHANNEL_MONITOR, "Received error on " -- 2.19.2.windows.1