Re: [PATCH] serial: sh-sci: Fix HSCIF RX sampling point adjustment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On March 29, 2019 at 10:10 AM Geert Uytterhoeven <geert+renesas@xxxxxxxxx> wrote:
> 
> 
> 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@xxxxxxxxx>
> ---
>  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 060fcd42b6d56010..2bdaeba5d527a6ce 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -2529,7 +2529,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.17.1
>

Reviewed-by: Ulrich Hecht <uli+renesas@xxxxxxxx>

CU
Uli



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux