Commit 8c39673d authored by Xiang Chen's avatar Xiang Chen Committed by Martin K. Petersen
Browse files

scsi: hisi_sas: Check sas_port before using it

parent 3b294c0f
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -974,12 +974,13 @@ static void hisi_sas_port_notify_formed(struct asd_sas_phy *sas_phy)
	struct hisi_hba *hisi_hba = sas_ha->lldd_ha;
	struct hisi_hba *hisi_hba = sas_ha->lldd_ha;
	struct hisi_sas_phy *phy = sas_phy->lldd_phy;
	struct hisi_sas_phy *phy = sas_phy->lldd_phy;
	struct asd_sas_port *sas_port = sas_phy->port;
	struct asd_sas_port *sas_port = sas_phy->port;
	struct hisi_sas_port *port = to_hisi_sas_port(sas_port);
	struct hisi_sas_port *port;
	unsigned long flags;
	unsigned long flags;


	if (!sas_port)
	if (!sas_port)
		return;
		return;


	port = to_hisi_sas_port(sas_port);
	spin_lock_irqsave(&hisi_hba->lock, flags);
	spin_lock_irqsave(&hisi_hba->lock, flags);
	port->port_attached = 1;
	port->port_attached = 1;
	port->id = phy->port_id;
	port->id = phy->port_id;