diff options
author | Changcheng Deng <deng.changcheng@zte.com.cn> | 2021-12-20 11:33:58 +0000 |
---|---|---|
committer | Damien Le Moal <damien.lemoal@opensource.wdc.com> | 2022-01-04 20:00:12 +0900 |
commit | da29947057950232f4ad8e0e118d2d5002daaf2b (patch) | |
tree | 2d671d27b6391f81193e6cd7a91d1668fd3ad96e /drivers/ata/libata-scsi.c | |
parent | 7b6acb4e7faa8590ac9b56874a2129a977da8890 (diff) | |
download | linux-da29947057950232f4ad8e0e118d2d5002daaf2b.tar.gz linux-da29947057950232f4ad8e0e118d2d5002daaf2b.tar.bz2 linux-da29947057950232f4ad8e0e118d2d5002daaf2b.zip |
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>
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r-- | drivers/ata/libata-scsi.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 5f27f5c29907..b0b7ab46a03c 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -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; } |