[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190424170929.312396893@linuxfoundation.org>
Date: Wed, 24 Apr 2019 19:10:09 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
Geert Uytterhoeven <geert+renesas@...der.be>,
Ulrich Hecht <uli+renesas@...nd.eu>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Dirk Behme <dirk.behme@...bosch.com>,
Simon Horman <horms+renesas@...ge.net.au>
Subject: [PATCH 5.0 073/115] serial: sh-sci: Fix HSCIF RX sampling point adjustment
From: Geert Uytterhoeven <geert+renesas@...der.be>
commit 6b87784b53592a90d21576be8eff688b56d93cce upstream.
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 <geert+renesas@...der.be>
Reviewed-by: Ulrich Hecht <uli+renesas@...nd.eu>
Reviewed-by: Wolfram Sang <wsa+renesas@...g-engineering.com>
Acked-by: Dirk Behme <dirk.behme@...bosch.com>
Cc: stable <stable@...r.kernel.org>
Reviewed-by: Simon Horman <horms+renesas@...ge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/tty/serial/sh-sci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2504,7 +2504,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;
Powered by blists - more mailing lists