ata: libata-eh: fix sloppy result type of ata_eh_nr_in_flight()
authorSergey Shtylyov <s.shtylyov@omp.ru>
Thu, 16 Jun 2022 20:51:48 +0000 (23:51 +0300)
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>
Sun, 19 Jun 2022 23:16:09 +0000 (08:16 +0900)
commitafae461a3bfa314c0432ab6871ca91a167fcb8be
treedfb1a6e269fa08621c62c8a7a07d4d66c948a8e9
parent4d6119f06ce14756777c4bb098fb4ad99a0a5d46
ata: libata-eh: fix sloppy result type of ata_eh_nr_in_flight()

ata_eh_nr_in_flight() counts the # of the active tagged commands and
thus cannot return a negative value but the result type is nevertheless
int.  Switching it to unsigned int (along with the local variables
receiving the function's result) helps avoiding the sign extension
instructions when comparing with or assigning to unsigned long
ata_port::fastdrain_cnt and thus results in a more compact 64-bit
code.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.

[Damien]
Fixed commit message.

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
drivers/ata/libata-eh.c