diff mbox

scsi: storvsc: missing error code in storvsc_probe()

Message ID 20180116104022.GA3517@mwanda (mailing list archive)
State Accepted
Headers show

Commit Message

Dan Carpenter Jan. 16, 2018, 10:40 a.m. UTC
We should set the error code if fc_remote_port_add() fails.

Fixes: daf0cd445a21 ("scsi: storvsc: Add support for FC rport.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Cathy Avery Jan. 16, 2018, 2:36 p.m. UTC | #1
On 01/16/2018 05:40 AM, Dan Carpenter wrote:
> We should set the error code if fc_remote_port_add() fails.
>
> Fixes: daf0cd445a21 ("scsi: storvsc: Add support for FC rport.")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
> index 3b3d1d050cac..40fc7a590e81 100644
> --- a/drivers/scsi/storvsc_drv.c
> +++ b/drivers/scsi/storvsc_drv.c
> @@ -1834,8 +1834,10 @@ static int storvsc_probe(struct hv_device *device,
>   		fc_host_node_name(host) = stor_device->node_name;
>   		fc_host_port_name(host) = stor_device->port_name;
>   		stor_device->rport = fc_remote_port_add(host, 0, &ids);
> -		if (!stor_device->rport)
> +		if (!stor_device->rport) {
> +			ret = -ENOMEM;
>   			goto err_out4;
> +		}
>   	}
>   #endif
>   	return 0;

Reviewed-by: Cathy Avery <cavery@redhat.com>
KY Srinivasan Jan. 16, 2018, 3:10 p.m. UTC | #2
> -----Original Message-----
> From: Cathy Avery [mailto:cavery@redhat.com]
> Sent: Tuesday, January 16, 2018 6:36 AM
> To: Dan Carpenter <dan.carpenter@oracle.com>; KY Srinivasan
> <kys@microsoft.com>
> Cc: Haiyang Zhang <haiyangz@microsoft.com>; Stephen Hemminger
> <sthemmin@microsoft.com>; James E.J. Bottomley
> <jejb@linux.vnet.ibm.com>; Martin K. Petersen
> <martin.petersen@oracle.com>; devel@linuxdriverproject.org; linux-
> scsi@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: Re: [PATCH] scsi: storvsc: missing error code in storvsc_probe()
> 
> On 01/16/2018 05:40 AM, Dan Carpenter wrote:
> > We should set the error code if fc_remote_port_add() fails.
> >
> > Fixes: daf0cd445a21 ("scsi: storvsc: Add support for FC rport.")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
> > index 3b3d1d050cac..40fc7a590e81 100644
> > --- a/drivers/scsi/storvsc_drv.c
> > +++ b/drivers/scsi/storvsc_drv.c
> > @@ -1834,8 +1834,10 @@ static int storvsc_probe(struct hv_device
> *device,
> >   		fc_host_node_name(host) = stor_device->node_name;
> >   		fc_host_port_name(host) = stor_device->port_name;
> >   		stor_device->rport = fc_remote_port_add(host, 0, &ids);
> > -		if (!stor_device->rport)
> > +		if (!stor_device->rport) {
> > +			ret = -ENOMEM;
> >   			goto err_out4;
> > +		}
> >   	}
> >   #endif
> >   	return 0;
> 
> Reviewed-by: Cathy Avery <cavery@redhat.com>
Acked-by: K. Y. Srinivasan <kys@microsoft.com>
Martin K. Petersen Jan. 17, 2018, 6:18 a.m. UTC | #3
Dan,

> We should set the error code if fc_remote_port_add() fails.

Applied to 4.16/scsi-queue, thanks!
diff mbox

Patch

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 3b3d1d050cac..40fc7a590e81 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1834,8 +1834,10 @@  static int storvsc_probe(struct hv_device *device,
 		fc_host_node_name(host) = stor_device->node_name;
 		fc_host_port_name(host) = stor_device->port_name;
 		stor_device->rport = fc_remote_port_add(host, 0, &ids);
-		if (!stor_device->rport)
+		if (!stor_device->rport) {
+			ret = -ENOMEM;
 			goto err_out4;
+		}
 	}
 #endif
 	return 0;