[PATCH] staging: qlge: unmap dma when lock failed
From: Xiangyang Zhang
Date: Sun May 17 2020 - 01:47:41 EST
DMA not unmapped when lock failed, this patch fixed it.
Signed-off-by: Xiangyang Zhang <xyz.sun.ok@xxxxxxxxx>
---
drivers/staging/qlge/qlge_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index a9163fb659d9..402edaeffe12 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -227,7 +227,7 @@ int ql_write_cfg(struct ql_adapter *qdev, void *ptr, int size, u32 bit,
status = ql_sem_spinlock(qdev, SEM_ICB_MASK);
if (status)
- return status;
+ goto lock_failed;
status = ql_wait_cfg(qdev, bit);
if (status) {
@@ -249,6 +249,7 @@ int ql_write_cfg(struct ql_adapter *qdev, void *ptr, int size, u32 bit,
status = ql_wait_cfg(qdev, bit);
exit:
ql_sem_unlock(qdev, SEM_ICB_MASK); /* does flush too */
+lock_failed:
dma_unmap_single(&qdev->pdev->dev, map, size, direction);
return status;
}
--
2.19.1