diff mbox series

[-next] scsi: cxlflash: Fix error return code in cxlflash_probe()

Message ID 20200428141855.88704-1-weiyongjun1@huawei.com (mailing list archive)
State Mainlined
Commit d0b1e4a638d670a09f42017a3e567dc846931ba8
Headers show
Series [-next] scsi: cxlflash: Fix error return code in cxlflash_probe() | expand

Commit Message

Wei Yongjun April 28, 2020, 2:18 p.m. UTC
Fix to return negative error code -ENOMEM from create_afu error
handling case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/scsi/cxlflash/main.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Matthew R. Ochs May 18, 2020, 9:41 p.m. UTC | #1
On Tue, Apr 28, 2020 at 02:18:55PM +0000, Wei Yongjun wrote:
> Fix to return negative error code -ENOMEM from create_afu error
> handling case instead of 0, as done elsewhere in this function.
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Acked-by: Matthew R. Ochs <mrochs@linux.ibm.com>

> ---
>  drivers/scsi/cxlflash/main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
> index fbd2ae40dab4..fcc5aa9f6014 100644
> --- a/drivers/scsi/cxlflash/main.c
> +++ b/drivers/scsi/cxlflash/main.c
> @@ -3744,6 +3744,7 @@ static int cxlflash_probe(struct pci_dev *pdev,
>  	cfg->afu_cookie = cfg->ops->create_afu(pdev);
>  	if (unlikely(!cfg->afu_cookie)) {
>  		dev_err(dev, "%s: create_afu failed\n", __func__);
> +		rc = -ENOMEM;
>  		goto out_remove;
>  	}
> 
> 
>
Martin K. Petersen May 20, 2020, 2:30 a.m. UTC | #2
On Tue, 28 Apr 2020 14:18:55 +0000, Wei Yongjun wrote:

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

Applied to 5.8/scsi-queue, thanks!

[1/1] scsi: cxlflash: Fix error return code in cxlflash_probe()
      https://git.kernel.org/mkp/scsi/c/d0b1e4a638d6
diff mbox series

Patch

diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index fbd2ae40dab4..fcc5aa9f6014 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -3744,6 +3744,7 @@  static int cxlflash_probe(struct pci_dev *pdev,
 	cfg->afu_cookie = cfg->ops->create_afu(pdev);
 	if (unlikely(!cfg->afu_cookie)) {
 		dev_err(dev, "%s: create_afu failed\n", __func__);
+		rc = -ENOMEM;
 		goto out_remove;
 	}