summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_dh.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2017-09-20 10:18:52 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2017-09-26 02:03:22 +0300
commit2930f817132959254db801fe19e61c477293ad6b (patch)
tree57bf1681caed48258094ac628461771be2aa7053 /drivers/scsi/scsi_dh.c
parent2a8f7a0344c8b068cf4b13f1bf4bdd65b8787d04 (diff)
downloadlinux-2930f817132959254db801fe19e61c477293ad6b.tar.xz
scsi: scsi_dh: suppress errors from unsupported devices
Device handlers are optional, and for some handlers like ALUA only implemented for certain device types. So suppress any errors for unsupported devices. Signed-off-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_dh.c')
-rw-r--r--drivers/scsi/scsi_dh.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c
index ac798d284a7e..2b785d09d5bd 100644
--- a/drivers/scsi/scsi_dh.c
+++ b/drivers/scsi/scsi_dh.c
@@ -140,12 +140,17 @@ static int scsi_dh_handler_attach(struct scsi_device *sdev,
case SCSI_DH_RES_TEMP_UNAVAIL:
ret = -EAGAIN;
break;
+ case SCSI_DH_DEV_UNSUPP:
+ case SCSI_DH_NOSYS:
+ ret = -ENODEV;
+ break;
default:
ret = -EINVAL;
break;
}
- sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%d)\n",
- scsi_dh->name, error);
+ if (ret != -ENODEV)
+ sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%d)\n",
+ scsi_dh->name, error);
module_put(scsi_dh->module);
} else
sdev->handler = scsi_dh;
@@ -164,18 +169,20 @@ static void scsi_dh_handler_detach(struct scsi_device *sdev)
module_put(sdev->handler->module);
}
-int scsi_dh_add_device(struct scsi_device *sdev)
+void scsi_dh_add_device(struct scsi_device *sdev)
{
struct scsi_device_handler *devinfo = NULL;
const char *drv;
- int err = 0;
drv = scsi_dh_find_driver(sdev);
if (drv)
devinfo = __scsi_dh_lookup(drv);
+ /*
+ * device_handler is optional, so ignore errors
+ * from scsi_dh_handler_attach()
+ */
if (devinfo)
- err = scsi_dh_handler_attach(sdev, devinfo);
- return err;
+ (void)scsi_dh_handler_attach(sdev, devinfo);
}
void scsi_dh_release_device(struct scsi_device *sdev)