kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: cxlflash: Fix an error handling path in 'cxlflash_disk_attach()'
@ 2017-08-15 20:18 Christophe JAILLET
  2017-08-16  0:21 ` Matthew R. Ochs
  2017-08-16  2:11 ` Martin K. Petersen
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2017-08-15 20:18 UTC (permalink / raw)
  To: manoj, mrochs, ukrishn, jejb, martin.petersen
  Cc: linux-scsi, linux-kernel, kernel-janitors, Christophe JAILLET

'rc' is known to be 0 at this point.
If 'create_context()' fails, returns -ENOMEM instead of 0 which means
success.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/scsi/cxlflash/superpipe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/cxlflash/superpipe.c b/drivers/scsi/cxlflash/superpipe.c
index ad0f9968ccfb..08da593cb2f6 100644
--- a/drivers/scsi/cxlflash/superpipe.c
+++ b/drivers/scsi/cxlflash/superpipe.c
@@ -1390,6 +1390,7 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,
 	if (unlikely(!ctxi)) {
 		dev_err(dev, "%s: Failed to create context ctxid=%d\n",
 			__func__, ctxid);
+		rc = -ENOMEM;
 		goto err;
 	}
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: cxlflash: Fix an error handling path in 'cxlflash_disk_attach()'
  2017-08-15 20:18 [PATCH] scsi: cxlflash: Fix an error handling path in 'cxlflash_disk_attach()' Christophe JAILLET
@ 2017-08-16  0:21 ` Matthew R. Ochs
  2017-08-16  2:11 ` Martin K. Petersen
  1 sibling, 0 replies; 4+ messages in thread
From: Matthew R. Ochs @ 2017-08-16  0:21 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Manoj N. Kumar, Uma Krishnan, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel, kernel-janitors

> On Aug 15, 2017, at 3:18 PM, Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> 
> 'rc' is known to be 0 at this point.
> If 'create_context()' fails, returns -ENOMEM instead of 0 which means
> success.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Yep, that's a bug.

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: cxlflash: Fix an error handling path in 'cxlflash_disk_attach()'
  2017-08-15 20:18 [PATCH] scsi: cxlflash: Fix an error handling path in 'cxlflash_disk_attach()' Christophe JAILLET
  2017-08-16  0:21 ` Matthew R. Ochs
@ 2017-08-16  2:11 ` Martin K. Petersen
  1 sibling, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2017-08-16  2:11 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: manoj, mrochs, ukrishn, jejb, martin.petersen, linux-scsi,
	linux-kernel, kernel-janitors


Christophe,

> 'rc' is known to be 0 at this point.
> If 'create_context()' fails, returns -ENOMEM instead of 0 which means
> success.

Applied to 4.14/scsi-queue. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: cxlflash: Fix an error handling path in 'cxlflash_disk_attach()'
       [not found] <20170815201835.781F76A041@b03ledav003.gho.boulder.ibm.com>
@ 2017-08-16  5:32 ` Andrew Donnellan
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Donnellan @ 2017-08-16  5:32 UTC (permalink / raw)
  To: Christophe JAILLET, manoj, mrochs, ukrishn, jejb, martin.petersen
  Cc: linux-scsi, linux-kernel, kernel-janitors

On 16/08/17 06:18, Christophe JAILLET wrote:
> 'rc' is known to be 0 at this point.
> If 'create_context()' fails, returns -ENOMEM instead of 0 which means
> success.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

ENOMEM seems right here.

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

> ---
>   drivers/scsi/cxlflash/superpipe.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/cxlflash/superpipe.c b/drivers/scsi/cxlflash/superpipe.c
> index ad0f9968ccfb..08da593cb2f6 100644
> --- a/drivers/scsi/cxlflash/superpipe.c
> +++ b/drivers/scsi/cxlflash/superpipe.c
> @@ -1390,6 +1390,7 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,
>   	if (unlikely(!ctxi)) {
>   		dev_err(dev, "%s: Failed to create context ctxid=%d\n",
>   			__func__, ctxid);
> +		rc = -ENOMEM;
>   		goto err;
>   	}
>   
> 

-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com  IBM Australia Limited


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-16  5:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-15 20:18 [PATCH] scsi: cxlflash: Fix an error handling path in 'cxlflash_disk_attach()' Christophe JAILLET
2017-08-16  0:21 ` Matthew R. Ochs
2017-08-16  2:11 ` Martin K. Petersen
     [not found] <20170815201835.781F76A041@b03ledav003.gho.boulder.ibm.com>
2017-08-16  5:32 ` Andrew Donnellan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).