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>
This commit is contained in:
Changcheng Deng 2021-12-20 11:33:58 +00:00 committed by Damien Le Moal
parent 7b6acb4e7f
commit da29947057

View File

@ -3591,10 +3591,7 @@ static int ata_mselect_caching(struct ata_queued_cmd *qc,
*/
if (len != CACHE_MPAGE_LEN - 2) {
if (len < CACHE_MPAGE_LEN - 2)
*fp = len;
else
*fp = CACHE_MPAGE_LEN - 2;
*fp = min(len, CACHE_MPAGE_LEN - 2);
return -EINVAL;
}
@ -3647,10 +3644,7 @@ static int ata_mselect_control(struct ata_queued_cmd *qc,
*/
if (len != CONTROL_MPAGE_LEN - 2) {
if (len < CONTROL_MPAGE_LEN - 2)
*fp = len;
else
*fp = CONTROL_MPAGE_LEN - 2;
*fp = min(len, CONTROL_MPAGE_LEN - 2);
return -EINVAL;
}