Skip to contentSkip to conversation

libata: fix hw_sata_spd_limit initialization

PATCH Applied Tejun Heo 2 participants 2 messages Jun 6, 2007 – Jun 10, 2007 libata

lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

PATCH 1/1 libata: fix hw_sata_spd_limit initialization

hw_sata_spd_limit used to be incorrectly initialized to zero instead of UINT_MAX if SPD is zero in SControl register. This breaks PHY speed down. Fix it.

---
 drivers/ata/libata-core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/ata/libata-core.c +2 -1
@@ -6318,7 +6318,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
 		/* init sata_spd_limit to the current value */
 		if (sata_scr_read(ap, SCR_CONTROL, &scontrol) == 0) {
 			int spd = (scontrol >> 4) & 0xf;
-			ap->hw_sata_spd_limit &= (1 << spd) - 1;
+			if (spd)
+				ap->hw_sata_spd_limit &= (1 << spd) - 1;
 		}
 		ap->sata_spd_limit = ap->hw_sata_spd_limit;
 
Applied
#1 lore raw
Quoted 8 lines · Tejun Heo

hw_sata_spd_limit used to be incorrectly initialized to zero instead of UINT_MAX if SPD is zero in SControl register. This breaks PHY speed down. Fix it.

---
 drivers/ata/libata-core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

applied