From: Wei Huang Date: Thu, 5 Nov 2020 02:05:39 +0000 (-0500) Subject: raw/ifpga/base: unlock mutex on Nios init failure X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2414339cee422a1401a399ba225132dd1a49d34a;p=dpdk.git raw/ifpga/base: unlock mutex on Nios init failure 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. Coverity issue: 363751 Fixes: e41856b515ce ("raw/ifpga/base: enhance driver reliability in multi-process") Signed-off-by: Wei Huang Acked-by: Rosen Xu --- diff --git a/drivers/raw/ifpga/base/ifpga_fme.c b/drivers/raw/ifpga/base/ifpga_fme.c index 540bb1110d..f29ff3159b 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; }