Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b87784b authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Greg Kroah-Hartman
Browse files

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: 63ba1e00 ("serial: sh-sci: Support for HSCIF RX sampling point adjustment")
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarUlrich Hecht <uli+renesas@fpond.eu>
Reviewed-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: default avatarDirk Behme <dirk.behme@de.bosch.com>
Cc: stable <stable@vger.kernel.org>
Reviewed-by: default avatarSimon Horman <horms+renesas@verge.net.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ace96569
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2521,7 +2521,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;