diff mbox series

[1/1] scsi: qla2xxx: Fix error return code in qla82xx_write_flash_dword()

Message ID 20210514090952.6715-1-thunder.leizhen@huawei.com (mailing list archive)
State Accepted
Headers show
Series [1/1] scsi: qla2xxx: Fix error return code in qla82xx_write_flash_dword() | expand

Commit Message

Leizhen (ThunderTown) May 14, 2021, 9:09 a.m. UTC
Fix to return a negative error code from the error handling case instead
of 0, as done elsewhere in this function.

Fixes: a9083016a531 ("[SCSI] qla2xxx: Add ISP82XX support.")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/scsi/qla2xxx/qla_nx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Himanshu Madhani May 14, 2021, 2 p.m. UTC | #1
On 5/14/21 4:09 AM, Zhen Lei wrote:
> Fix to return a negative error code from the error handling case instead
> of 0, as done elsewhere in this function.
> 
> Fixes: a9083016a531 ("[SCSI] qla2xxx: Add ISP82XX support.")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>   drivers/scsi/qla2xxx/qla_nx.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
> index 0677295957bc5cb..615e44af1ca6043 100644
> --- a/drivers/scsi/qla2xxx/qla_nx.c
> +++ b/drivers/scsi/qla2xxx/qla_nx.c
> @@ -1063,7 +1063,8 @@ qla82xx_write_flash_dword(struct qla_hw_data *ha, uint32_t flashaddr,
>   		return ret;
>   	}
>   
> -	if (qla82xx_flash_set_write_enable(ha))
> +	ret = qla82xx_flash_set_write_enable(ha);
> +	if (ret < 0)
>   		goto done_write;
>   
>   	qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_WDATA, data);
> 

Makes sense.

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Martin K. Petersen May 15, 2021, 10:14 p.m. UTC | #2
On Fri, 14 May 2021 17:09:52 +0800, Zhen Lei wrote:

> Fix to return a negative error code from the error handling case instead
> of 0, as done elsewhere in this function.

Applied to 5.13/scsi-fixes, thanks!

[1/1] scsi: qla2xxx: Fix error return code in qla82xx_write_flash_dword()
      https://git.kernel.org/mkp/scsi/c/5cb289bf2d7c
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index 0677295957bc5cb..615e44af1ca6043 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -1063,7 +1063,8 @@  qla82xx_write_flash_dword(struct qla_hw_data *ha, uint32_t flashaddr,
 		return ret;
 	}
 
-	if (qla82xx_flash_set_write_enable(ha))
+	ret = qla82xx_flash_set_write_enable(ha);
+	if (ret < 0)
 		goto done_write;
 
 	qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_WDATA, data);