carl9170: clean up a clamp() call
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 18 Feb 2019 09:31:54 +0000 (12:31 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 19 Feb 2019 15:18:14 +0000 (17:18 +0200)
The parameter order for clamp is supposed to be clamp(value, low, high).
When we write it in this order it's equivalent to
min(head->plcp[3] & 0x7f, 75) which works in this context where the min
is zero.  But it's not a correct use of the API.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/carl9170/rx.c

index f7c2f19e81c16433fb08a1e06725e5eb7ba630d1..8e154f6364a38081c5db587895b1f2bc76bd69a9 100644 (file)
@@ -427,7 +427,7 @@ static int carl9170_rx_mac_status(struct ar9170 *ar,
                if (head->plcp[6] & 0x80)
                        status->enc_flags |= RX_ENC_FLAG_SHORT_GI;
 
-               status->rate_idx = clamp(0, 75, head->plcp[3] & 0x7f);
+               status->rate_idx = clamp(head->plcp[3] & 0x7f, 0, 75);
                status->encoding = RX_ENC_HT;
                break;