From 32cde852a03fa7fbb450d5665785b1ff390d3867 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Thu, 28 Mar 2019 12:10:58 +0100 Subject: [PATCH] serial: sh-sci: Fix HSCIF RX sampling point adjustment In commit 63ba1e00f178 ("serial: sh-sci: Support for HSCIF RX sampling point adjustment") min and max are exchanged. Fix this. Fixes: 63ba1e00f178 ("serial: sh-sci: Support for HSCIF RX sampling point adjustment") Cc: # v4.18+ Signed-off-by: Geert Uytterhoeven Signed-off-by: Dirk Behme --- drivers/tty/serial/sh-sci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index eba08cd892e5..69896d586a29 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -2446,7 +2446,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, * 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; -- 2.20.0