DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wei Huang <wei.huang@intel.com>
To: dev@dpdk.org, rosen.xu@intel.com, qi.z.zhang@intel.com
Cc: stable@dpdk.org, Wei Huang <wei.huang@intel.com>
Subject: [dpdk-dev] [PATCH v2 1/2] raw/ifpga/base: unlock mutex when nios init fail
Date: Wed,  4 Nov 2020 21:05:39 -0500
Message-ID: <1604541940-5994-2-git-send-email-wei.huang@intel.com> (raw)
In-Reply-To: <1604541940-5994-1-git-send-email-wei.huang@intel.com>

In fme_nios_spi_init(), a mutex is locked for protecting nios
initialization process, the mutex is only unlocked when process
is successful, it should also be unlocked when process fail.

Fixes: e41856b515ce ("raw/ifpga/base: enhance driver reliability in multi-process")
Coverity issue: 363751

Signed-off-by: Wei Huang <wei.huang@intel.com>
 drivers/raw/ifpga/base/ifpga_fme.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/raw/ifpga/base/ifpga_fme.c b/drivers/raw/ifpga/base/ifpga_fme.c
index 540bb1110..f29ff3159 100644
--- a/drivers/raw/ifpga/base/ifpga_fme.c
+++ b/drivers/raw/ifpga/base/ifpga_fme.c
@@ -1115,6 +1115,8 @@ static int fme_nios_spi_init(struct ifpga_feature *feature)
 	ret = nios_spi_wait_init_done(spi_master);
 	if (ret != 0) {
 		dev_err(fme, "FME NIOS_SPI init fail\n");
+		if (spi_master->mutex)
+			pthread_mutex_unlock(spi_master->mutex);
 		goto release_dev;

  reply	other threads:[~2020-11-05  3:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05  2:05 [dpdk-dev] [PATCH v2 0/2] raw/ifpga/base: fix defects found by coverity scan Wei Huang
2020-11-05  2:05 ` Wei Huang [this message]
2020-11-05 11:32   ` [dpdk-dev] [PATCH v2 1/2] raw/ifpga/base: unlock mutex when nios init fail Xu, Rosen
2020-11-05  2:05 ` [dpdk-dev] [PATCH v2 2/2] raw/ifpga/base: check pointer adapter before dereference Wei Huang
2020-11-05 11:32   ` Xu, Rosen
2020-11-09  9:41 ` [dpdk-dev] [PATCH v2 0/2] raw/ifpga/base: fix defects found by coverity scan Zhang, Qi Z

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1604541940-5994-2-git-send-email-wei.huang@intel.com \
    --to=wei.huang@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=rosen.xu@intel.com \
    --cc=stable@dpdk.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git