Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ata: libata: use min() to make code cleaner

Use min() in order to make code cleaner.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

authored by

Changcheng Deng and committed by
Damien Le Moal
da299470 7b6acb4e

+2 -8
+2 -8
drivers/ata/libata-scsi.c
··· 3591 3591 */ 3592 3592 3593 3593 if (len != CACHE_MPAGE_LEN - 2) { 3594 - if (len < CACHE_MPAGE_LEN - 2) 3595 - *fp = len; 3596 - else 3597 - *fp = CACHE_MPAGE_LEN - 2; 3594 + *fp = min(len, CACHE_MPAGE_LEN - 2); 3598 3595 return -EINVAL; 3599 3596 } 3600 3597 ··· 3644 3647 */ 3645 3648 3646 3649 if (len != CONTROL_MPAGE_LEN - 2) { 3647 - if (len < CONTROL_MPAGE_LEN - 2) 3648 - *fp = len; 3649 - else 3650 - *fp = CONTROL_MPAGE_LEN - 2; 3650 + *fp = min(len, CONTROL_MPAGE_LEN - 2); 3651 3651 return -EINVAL; 3652 3652 } 3653 3653