summaryrefslogtreecommitdiff
path: root/drivers/ata
diff options
context:
space:
mode:
authorLi Zhong <floridsleeves@gmail.com>2022-09-03 16:10:39 -0700
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>2022-09-16 23:24:06 +0900
commit55d5ba550535c970c03cd0d0008ad1d61b238be4 (patch)
treec38cf4c81a3d5f8508b8b889cb2b18e840880032 /drivers/ata
parent03070458d700242f1caf6ede4225a728145ccd77 (diff)
ata: libata-core: Check errors in sata_print_link_status()
sata_scr_read() could return negative error code on failure. Check the return value when reading the control register. Signed-off-by: Li Zhong <floridsleeves@gmail.com> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index d0242c75aac5..75b86913db1a 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3021,7 +3021,8 @@ static void sata_print_link_status(struct ata_link *link)
if (sata_scr_read(link, SCR_STATUS, &sstatus))
return;
- sata_scr_read(link, SCR_CONTROL, &scontrol);
+ if (sata_scr_read(link, SCR_CONTROL, &scontrol))
+ return;
if (ata_phys_link_online(link)) {
tmp = (sstatus >> 4) & 0xf;