]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitd599575caeda00f855b5a2902e80656cd3afe5be
treedfb1a6e269fa08621c62c8a7a07d4d66c948a8e9
parent4852ee173d28a9b910459882ae38856cbc074adb
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