From 2414339cee422a1401a399ba225132dd1a49d34a Mon Sep 17 00:00:00 2001 From: Wei Huang Date: Wed, 4 Nov 2020 21:05:39 -0500 Subject: [PATCH] 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 --- 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 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; } -- 2.20.1