2018-06-04 03:33:25

by Xiaoming Ni

[permalink] [raw]
Subject: For help, whether to check the return value of sata_scr_read should be added in sata_print_link_status

Hello
I have trouble reading the code, I hope you can help guide

The function sata_print_link_status in the file drivers/ata/libata-core.c checks the return value when the function sata_scr_read is called on line 3009,
but does not check the return value when calling sata_scr_read on line 3011.
Why are two calls handled differently?
Is there any other code logic that guarantees that the 3011 line will not return an exception?

drivers/ata/libata-core.c :
3005 static void sata_print_link_status(struct ata_link *link)
3006 {
3007 u32 sstatus, scontrol, tmp;
3008
3009 if (sata_scr_read(link, SCR_STATUS, &sstatus))
3010 return;
3011 sata_scr_read(link, SCR_CONTROL, &scontrol);
3012
3013 if (ata_phys_link_online(link)) {

Thanks