From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 0411B1B00B; Wed, 16 May 2018 15:47:42 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 May 2018 06:47:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,406,1520924400"; d="scan'208";a="41413019" Received: from dpdkx8602.sh.intel.com ([10.67.110.200]) by orsmga007.jf.intel.com with ESMTP; 16 May 2018 06:47:38 -0700 From: Rosen Xu To: dev@dpdk.org, thomas@monjalon.net Cc: rosen.xu@intel.com, roy.fan.zhang@intel.com, declan.doherty@intel.com, bruce.richardson@intel.com, shreyansh.jain@nxp.com, ferruh.yigit@intel.com, konstantin.ananyev@intel.com, tianfei.zhang@intel.com, song.liu@intel.com, hao.wu@intel.com, gaetan.rivet@6wind.com, stable@dpdk.org Date: Wed, 16 May 2018 21:48:26 +0800 Message-Id: <1526478506-153943-1-git-send-email-rosen.xu@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1521553556-62982-1-git-send-email-rosen.xu@intel.com> References: <1521553556-62982-1-git-send-email-rosen.xu@intel.com> Subject: [dpdk-dev] [PATCH] drivers/bus/ifpga/: fix Coverity issue 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: , X-List-Received-Date: Wed, 16 May 2018 13:47:43 -0000 Fix Coverity issue: 279455, 279459 and 279454 Signed-off-by: Rosen Xu Fixes: 05fa3d4a6539 ("bus/ifpga: add Intel FPGA bus library") Coverity issue: 279455, 279459 and 279454 Cc: stable@dpdk.org --- drivers/bus/ifpga/ifpga_bus.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index 45597a1..b324872 100644 --- a/drivers/bus/ifpga/ifpga_bus.c +++ b/drivers/bus/ifpga/ifpga_bus.c @@ -156,27 +156,30 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver) if (rawdev->dev_ops && rawdev->dev_ops->dev_start && rawdev->dev_ops->dev_start(rawdev)) - goto free_dev; + goto end; strlcpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path)); - if (rawdev->dev_ops->firmware_load && + if (rawdev->dev_ops && + rawdev->dev_ops->firmware_load && rawdev->dev_ops->firmware_load(rawdev, &afu_pr_conf)){ IFPGA_BUS_ERR("firmware load error %d\n", ret); - goto free_dev; + goto end; } afu_dev->id.uuid.uuid_low = afu_pr_conf.afu_id.uuid.uuid_low; afu_dev->id.uuid.uuid_high = afu_pr_conf.afu_id.uuid.uuid_high; + rte_kvargs_free(kvlist); + free(path); return afu_dev; -free_dev: - free(afu_dev); end: if (kvlist) rte_kvargs_free(kvlist); if (path) free(path); + if (afu_dev) + free(afu_dev); return NULL; } @@ -367,7 +370,7 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver) return -EINVAL; afu_dev = RTE_DEV_TO_AFU(dev); - if (!dev) + if (!afu_dev) return -ENOENT; devargs = dev->devargs; -- 1.8.3.1