diff mbox series

[03/13] mpt3sas: Fix clear pending bit in ioctl status

Message ID 1568379890-18347-4-git-send-email-sreekanth.reddy@broadcom.com (mailing list archive)
State Accepted
Headers show
Series Enhancements w.r.t to diag buffer and few bug fixes | expand

Commit Message

Sreekanth Reddy Sept. 13, 2019, 1:04 p.m. UTC
Issue:
 when user issues diag register command from application with
 required size and if driver unable to allocate the memory then it
 will fail the register command. While failing the register command
 currently driver is not clearing MPT3_CMD_PENDING bit in
 ctl_cmds.status variable which was set before trying to allocate the
 memory. As this bit is set so subsequent register command will be failed
 with BUSY status even when user wants to register the trace buffer
 will less memory.

Fix:
 Clear MPT3_CMD_PENDING bit in ctl_cmds.status before returning
 the diag register command with no memory status.

Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
---
 drivers/scsi/mpt3sas/mpt3sas_ctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index 76ca416..a195cae 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -1591,7 +1591,8 @@  _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc,
 			ioc_err(ioc, "%s: failed allocating memory for diag buffers, requested size(%d)\n",
 				__func__, request_data_sz);
 			mpt3sas_base_free_smid(ioc, smid);
-			return -ENOMEM;
+			rc = -ENOMEM;
+			goto out;
 		}
 		ioc->diag_buffer[buffer_type] = request_data;
 		ioc->diag_buffer_sz[buffer_type] = request_data_sz;