diff mbox series

[-next,resend] scsi: mpi3mr: Fix error return code in mpi3mr_init_ioc()

Message ID 20210603151653.711020-1-yangyingliang@huawei.com (mailing list archive)
State Accepted
Headers show
Series [-next,resend] scsi: mpi3mr: Fix error return code in mpi3mr_init_ioc() | expand

Commit Message

Yang Yingliang June 3, 2021, 3:16 p.m. UTC
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: fb9b04574f14 ("scsi: mpi3mr: Add support for recovering controller")
Fixes: 824a156633df ("scsi: mpi3mr: Base driver code")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/scsi/mpi3mr/mpi3mr_fw.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kashyap Desai June 16, 2021, 1:44 p.m. UTC | #1
On Thu, Jun 3, 2021 at 8:42 PM Yang Yingliang <yangyingliang@huawei.com> wrote:
>
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
>
> Fixes: fb9b04574f14 ("scsi: mpi3mr: Add support for recovering controller")
> Fixes: 824a156633df ("scsi: mpi3mr: Base driver code")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/scsi/mpi3mr/mpi3mr_fw.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
> index acb2be62080a..dbf116414855 100644
> --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
> +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
> @@ -3295,6 +3295,7 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc, u8 re_init)
>         }
>         ioc_state = mpi3mr_get_iocstate(mrioc);
>         if (ioc_state != MRIOC_STATE_RESET) {
> +               retval = -1;
>                 ioc_err(mrioc, "Cannot bring IOC to reset state\n");
>                 goto out_failed;
>         }
> @@ -3391,6 +3392,7 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc, u8 re_init)
>
>         if (re_init &&
>             (mrioc->shost->nr_hw_queues > mrioc->num_op_reply_q)) {
> +               retval = -1;
>                 ioc_err(mrioc,
>                     "Cannot create minimum number of OpQueues expected:%d created:%d\n",
>                     mrioc->shost->nr_hw_queues, mrioc->num_op_reply_q);
> --

Acked-by: Kashyap Desai <kashyap.desai@broadcom.com>

> 2.25.1
>
Martin K. Petersen June 19, 2021, 2:03 a.m. UTC | #2
Yang,

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

Applied to 5.14/scsi-staging, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
index acb2be62080a..dbf116414855 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -3295,6 +3295,7 @@  int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc, u8 re_init)
 	}
 	ioc_state = mpi3mr_get_iocstate(mrioc);
 	if (ioc_state != MRIOC_STATE_RESET) {
+		retval = -1;
 		ioc_err(mrioc, "Cannot bring IOC to reset state\n");
 		goto out_failed;
 	}
@@ -3391,6 +3392,7 @@  int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc, u8 re_init)
 
 	if (re_init &&
 	    (mrioc->shost->nr_hw_queues > mrioc->num_op_reply_q)) {
+		retval = -1;
 		ioc_err(mrioc,
 		    "Cannot create minimum number of OpQueues expected:%d created:%d\n",
 		    mrioc->shost->nr_hw_queues, mrioc->num_op_reply_q);