Skip to content
  • Jiri Slaby's avatar
    mxser: fix timeout calculation for low rates · 104583b5
    Jiri Slaby authored
    
    
    Paul reported, that low rates like B300 make the driver to hang in
    mxser_wait_until_sent. His debugging tackled the issue down to the
    info->timeout computation in mxser_set_baud. Obviously, ints are used
    there and they easily overflow with these low rates: B300 makes
    info->timeout to be -373.
    
    So switch all these types to unsigned as it ought to be. And use the u64
    domain to perform the computation as in the worst case, we need 35 bits
    to store the computed value (before division).
    
    And use do_div not to break 32 bit kernels.
    
    [v2] make it actually build
    
    Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
    Cc: Paul <Paul@abelian.netcom.co.uk>
    Tested-by: default avatar <Paul@abelian.netcom.co.uk>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    104583b5