diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index e5e9bf3487db16d20612e1fdd57cbb593cdd750c..674461fb6a3ef675a305ab589597ea8a31fda941 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -5073,6 +5073,12 @@ static void __devexit mptsas_remove(struct pci_dev *pdev) struct mptsas_portinfo *p, *n; int i; + if (!ioc->sh) { + printk(MYIOC_s_INFO_FMT "IOC is in Target mode\n", ioc->name); + mpt_detach(pdev); + return; + } + mptsas_shutdown(pdev); mptsas_del_device_components(ioc); diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 929d584855d25ddb0a5d139b35b71ea1ce7c944c..b966678e4419b50fd6efba77c1cb5a8ae34edf56 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c @@ -1149,11 +1149,6 @@ mptscsih_remove(struct pci_dev *pdev) MPT_SCSI_HOST *hd; int sz1; - if(!host) { - mpt_detach(pdev); - return; - } - scsi_remove_host(host); if((hd = shost_priv(host)) == NULL)