Re: [PATCH 4/7] USB: serial: ftdi_sio: Do not reset baudrate to 9600 on error

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

 



I forgot to look at your comments before sending v2, ouch :(

On Fri, 8 Jul 2022 17:51:00 +0200
Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:

> On Thu, Jul 7, 2022 at 4:57 PM Marek Behún <kabel@xxxxxxxxxx> wrote:
> >
> > From: Pali Rohár <pali@xxxxxxxxxx>
> >
> > On failure to set new baudrate, reset baudrate to the previous value  
> 
> a new
> baud rate
> 
> > (as is done by other serial drivers) instead of resetting to 9600.  
> 
> ...
> 
> > +                       baud = old_baud ? old_baud : 9600;  
> 
> Can be written as
> 
>   baud = old_baud ?: 9600;
> 
> ...
> 
> > +                       if (div_value == (u32)-1) {  
> 
> Oh, unsigned -1? Can you define it with a meaningful name and depends
> on the semantics use U32_MAX or GENMASK()?
> 
> > +                               baud = 9600;
> > +                               div_value = ftdi_sio_baud_to_divisor(baud);
> > +                       }  
> 
> ...
> 
> > +                       baud = (old_baud >= 183 && old_baud <= 3000000) ? old_baud : 9600;  
> 
> These repetitive magics are error prone (easy to make a mistake or
> off-by-one error). Can you create a simple helper for this?
> 





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux