aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeert Uytterhoeven <[email protected]>2019-03-29 10:10:26 +0100
committerGreg Kroah-Hartman <[email protected]>2019-04-16 15:24:38 +0200
commit6b87784b53592a90d21576be8eff688b56d93cce (patch)
tree73e77a37beb9fae246d32f8e0bccf51f5436c4f5
parentace965696da2611af759f0284e26342b7b6cec89 (diff)
serial: sh-sci: Fix HSCIF RX sampling point adjustment
The calculation of the sampling point has min() and max() exchanged. Fix this by using the clamp() helper instead. Fixes: 63ba1e00f178a448 ("serial: sh-sci: Support for HSCIF RX sampling point adjustment") Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Ulrich Hecht <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Acked-by: Dirk Behme <[email protected]> Cc: stable <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/tty/serial/sh-sci.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 55ef6e577f46..3cd139752d3f 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2521,7 +2521,7 @@ done:
* last stop bit; we can increase the error
* margin by shifting the sampling point.
*/
- int shift = min(-8, max(7, deviation / 2));
+ int shift = clamp(deviation / 2, -8, 7);
hssrr |= (shift << HSCIF_SRHP_SHIFT) &
HSCIF_SRHP_MASK;