Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20f5895d authored by Kashyap, Desai's avatar Kashyap, Desai Committed by James Bottomley
Browse files

[SCSI] mpt2sas: Expander fix oops saying "Already part of another port"



Kernel panic is seen because driver did not tear down the port which should
be dnoe using mpt2sas_transport_port_remove(). without this fix When expander
is added back we would oops inside sas_port_add_phy.

Signed-off-by: default avatarKashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 15052c9e
Loading
Loading
Loading
Loading
+15 −6
Original line number Original line Diff line number Diff line
@@ -3426,7 +3426,7 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle)
	__le64 sas_address;
	__le64 sas_address;
	int i;
	int i;
	unsigned long flags;
	unsigned long flags;
	struct _sas_port *mpt2sas_port;
	struct _sas_port *mpt2sas_port = NULL;
	int rc = 0;
	int rc = 0;


	if (!handle)
	if (!handle)
@@ -3518,12 +3518,20 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle)
		    &expander_pg1, i, handle))) {
		    &expander_pg1, i, handle))) {
			printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
			printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
			    ioc->name, __FILE__, __LINE__, __func__);
			    ioc->name, __FILE__, __LINE__, __func__);
			continue;
			rc = -1;
			goto out_fail;
		}
		}
		sas_expander->phy[i].handle = handle;
		sas_expander->phy[i].handle = handle;
		sas_expander->phy[i].phy_id = i;
		sas_expander->phy[i].phy_id = i;
		mpt2sas_transport_add_expander_phy(ioc, &sas_expander->phy[i],

		    expander_pg1, sas_expander->parent_dev);
		if ((mpt2sas_transport_add_expander_phy(ioc,
		    &sas_expander->phy[i], expander_pg1,
		    sas_expander->parent_dev))) {
			printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
			    ioc->name, __FILE__, __LINE__, __func__);
			rc = -1;
			goto out_fail;
		}
	}
	}


	if (sas_expander->enclosure_handle) {
	if (sas_expander->enclosure_handle) {
@@ -3540,8 +3548,9 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle)


 out_fail:
 out_fail:


	if (sas_expander)
	if (mpt2sas_port)
		kfree(sas_expander->phy);
		mpt2sas_transport_port_remove(ioc, sas_expander->sas_address,
		    sas_expander->parent_handle);
	kfree(sas_expander);
	kfree(sas_expander);
	return rc;
	return rc;
}
}