From: Rosen Xu <rosen.xu@intel.com>
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
Subject: [dpdk-stable] [PATCH] drivers/bus/ifpga/: fix Coverity issue
Date: Wed, 16 May 2018 21:48:26 +0800 [thread overview]
Message-ID: <1526478506-153943-1-git-send-email-rosen.xu@intel.com> (raw)
In-Reply-To: <1521553556-62982-1-git-send-email-rosen.xu@intel.com>
Fix Coverity issue: 279455, 279459 and 279454
Signed-off-by: Rosen Xu <rosen.xu@intel.com>
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
next prev parent reply other threads:[~2018-05-16 13:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1521553556-62982-1-git-send-email-rosen.xu@intel.com>
2018-05-14 9:57 ` [dpdk-stable] [PATCH] raw/ifpga/base: fix compile error on ia32 icc compiler Xu, Rosen
2018-05-14 9:58 ` Xu, Rosen
2018-05-14 10:20 ` [dpdk-stable] [dpdk-dev] " De Lara Guarch, Pablo
2018-05-14 10:32 ` Thomas Monjalon
2018-05-16 13:48 ` Rosen Xu [this message]
2018-05-21 14:00 ` [dpdk-stable] [PATCH] drivers/bus/ifpga/: fix Coverity issue Thomas Monjalon
[not found] ` <1526984778-95506-1-git-send-email-rosen.xu@intel.com>
2018-05-22 10:26 ` [dpdk-stable] [PATCH v2 1/3] bus/ifpga: fix error control flow issue Rosen Xu
2018-05-22 10:26 ` [dpdk-stable] [PATCH v2 2/3] bus/ifpga: fix resource leaks issue Rosen Xu
2018-05-22 10:26 ` [dpdk-stable] [PATCH v2 3/3] bus/ifpga: fix null pointer dereferences issue Rosen Xu
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=1526478506-153943-1-git-send-email-rosen.xu@intel.com \
--to=rosen.xu@intel.com \
--cc=bruce.richardson@intel.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=gaetan.rivet@6wind.com \
--cc=hao.wu@intel.com \
--cc=konstantin.ananyev@intel.com \
--cc=roy.fan.zhang@intel.com \
--cc=shreyansh.jain@nxp.com \
--cc=song.liu@intel.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
--cc=tianfei.zhang@intel.com \
/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).