2020-05-17 05:49:05

by Xiangyang Zhang

[permalink] [raw]
Subject: [PATCH] staging: qlge: unmap dma when lock failed

DMA not unmapped when lock failed, this patch fixed it.

Signed-off-by: Xiangyang Zhang <[email protected]>
---
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


2020-05-18 04:58:13

by Benjamin Poirier

[permalink] [raw]
Subject: Re: [PATCH] staging: qlge: unmap dma when lock failed

On 2020-05-17 13:46 +0800, Xiangyang Zhang wrote:
> DMA not unmapped when lock failed, this patch fixed it.
>

Fixes: 4322c5bee85e ("qlge: Expand coverage of hw lock for config register.")

> Signed-off-by: Xiangyang Zhang <[email protected]>
> ---
> drivers/staging/qlge/qlge_main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>