summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/g_NCR5380.c
diff options
context:
space:
mode:
authorOndrej Zary <linux@rainbow-software.org>2016-12-05 07:07:19 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2016-12-08 22:56:41 +0100
commit89fa9b5cb08c9d8ad709415b88395be463eceeee (patch)
tree6f81312bb1202e6ef755c901a738adce24addf40 /drivers/scsi/g_NCR5380.c
parentscsi: qla4xxx: switch to pci_alloc_irq_vectors (diff)
downloadlinux-89fa9b5cb08c9d8ad709415b88395be463eceeee.tar.xz
linux-89fa9b5cb08c9d8ad709415b88395be463eceeee.zip
scsi: g_NCR5380: Check for chip presence before calling NCR5380_init()
Write and read back mode register to check that a chip is really there. If no card is present, reads result in 0xff. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Tested-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/g_NCR5380.c')
-rw-r--r--drivers/scsi/g_NCR5380.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index de5147a8c959..76e37455480e 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -248,6 +248,13 @@ static int generic_NCR5380_init_one(struct scsi_host_template *tpnt,
}
}
+ /* Check for vacant slot */
+ NCR5380_write(MODE_REG, 0);
+ if (NCR5380_read(MODE_REG) != 0) {
+ ret = -ENODEV;
+ goto out_unregister;
+ }
+
ret = NCR5380_init(instance, flags | FLAG_LATE_DMA_SETUP);
if (ret)
goto out_unregister;