mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
serial: sh-sci: Fix HSCIF RX sampling point adjustment
commit6b87784b53upstream. The calculation of the sampling point has min() and max() exchanged. Fix this by using the clamp() helper instead. Fixes:63ba1e00f1("serial: sh-sci: Support for HSCIF RX sampling point adjustment") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Dirk Behme <dirk.behme@de.bosch.com> Cc: stable <stable@vger.kernel.org> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ec96f65e12
commit
de6d6b8902
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user