scsi: storvsc: missing error code in storvsc_probe()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 16 Jan 2018 10:40:22 +0000 (13:40 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Feb 2018 09:19:49 +0000 (10:19 +0100)
commit ca8dc694045e9aa248e9916e0f614deb0494cb3d upstream.

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

Cc: <stable@vger.kernel.org> #v4.12+
Fixes: daf0cd445a21 ("scsi: storvsc: Add support for FC rport.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Cathy Avery <cavery@redhat.com>
Acked-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Long Li <longli@microsoft.com>
drivers/scsi/storvsc_drv.c

index 5e7200f0587364c8de771a56d4c7105c8f2400c6..c17ccb913fde9349d87a2bdc2a85c2d05c0a9b9b 100644 (file)
@@ -1826,8 +1826,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_out3;
+               }
        }
 #endif
        return 0;