Re: [PATCH v3 1/7] USB: serial: ftdi_sio: Fix divisor overflow

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

 



On Sat, Sep 24, 2022 at 12:27:12PM +0200, Pali Rohár wrote:
> The baud rate generating divisor is a 17-bit wide (14 bits integer part
> and 3 bits fractional part).
> 
> Example:
>   base clock = 48 MHz
>   requested baud rate = 180 Baud
>   divisor = 48,000,000 / (16 * 180) = 0b100000100011010.101
> 
>   In this case the MSB gets discarded because of the overflow, and the
>   actually used divisor will be 0b100011010.101 = 282.625, resulting
>   in baud rate 10615 Baud, instead of the requested 180 Baud.
> 
> The best possible thing to do in this case is to generate lowest possible
> baud rate (in the example it would be 183 Baud), by using maximum possible
> divisor.

As I already commented on v2:

	Actually, the best way to handle this is to add a sanity check
	for the lowest supported check as you do in the next patch. That
	one makes this change superfluous.

> In case of divisor overflow, use maximum possible divisor.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Pali Rohár <pali@xxxxxxxxxx>
> Tested-by: Marek Behún <kabel@xxxxxxxxxx>
> Signed-off-by: Marek Behún <kabel@xxxxxxxxxx>

And as I mentioned the other week, this SoB change is not correct as it
is you who are submitting these patches now and it's not clear whether
you intended that Marek should be attributed as co-author or not.

Johan



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux