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>
This commit is contained in:
Li Zhong 2022-09-03 16:10:39 -07:00 committed by Damien Le Moal
parent 03070458d7
commit 55d5ba5505

View File

@ -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;