spi: Fix missing unlock on error in sp7021_spi_master_transfer_one()
authorYang Yingliang <yangyingliang@huawei.com>
Thu, 27 Jan 2022 11:58:15 +0000 (19:58 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 28 Jan 2022 13:06:52 +0000 (13:06 +0000)
Add the missing unlock before return from sp7021_spi_master_transfer_one()
in the error handling case.

Fixes: f62ca4e2a863 ("spi: Add spi driver for Sunplus SP7021")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220127115815.3148950-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-sunplus-sp7021.c

index 627b9c3..cbbb166 100644 (file)
@@ -351,6 +351,7 @@ static int sp7021_spi_master_transfer_one(struct spi_controller *ctlr, struct sp
 
                if (!wait_for_completion_interruptible_timeout(&pspim->isr_done, timeout)) {
                        dev_err(&spi->dev, "wait_for_completion err\n");
+                       mutex_unlock(&pspim->buf_lock);
                        return -ETIMEDOUT;
                }