Skip to content

Commit 4851c39

Browse files
Lencerfmartinkpetersen
authored andcommitted
scsi: pm80xx: Add fatal error checks
Add fatal error checking for the pm8001_phy_control() and pm8001_lu_reset() functions. Signed-off-by: Changyuan Lyu <[email protected]> Signed-off-by: Pranav Prasad <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent b58b2ba commit 4851c39

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

drivers/scsi/pm8001/pm8001_sas.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,17 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
167167
pm8001_ha = sas_phy->ha->lldd_ha;
168168
phy = &pm8001_ha->phy[phy_id];
169169
pm8001_ha->phy[phy_id].enable_completion = &completion;
170+
171+
if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) {
172+
/*
173+
* If the controller is in fatal error state,
174+
* we will not get a response from the controller
175+
*/
176+
pm8001_dbg(pm8001_ha, FAIL,
177+
"Phy control failed due to fatal errors\n");
178+
return -EFAULT;
179+
}
180+
170181
switch (func) {
171182
case PHY_FUNC_SET_LINK_RATE:
172183
rates = funcdata;
@@ -908,6 +919,17 @@ int pm8001_lu_reset(struct domain_device *dev, u8 *lun)
908919
struct pm8001_device *pm8001_dev = dev->lldd_dev;
909920
struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev);
910921
DECLARE_COMPLETION_ONSTACK(completion_setstate);
922+
923+
if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) {
924+
/*
925+
* If the controller is in fatal error state,
926+
* we will not get a response from the controller
927+
*/
928+
pm8001_dbg(pm8001_ha, FAIL,
929+
"LUN reset failed due to fatal errors\n");
930+
return rc;
931+
}
932+
911933
if (dev_is_sata(dev)) {
912934
struct sas_phy *phy = sas_get_local_phy(dev);
913935
sas_execute_internal_abort_dev(dev, 0, NULL);

0 commit comments

Comments
 (0)