> > +   u32 baseline, mantissa, exponent;
> 
> Please keep these as unsigned int.
What's the reason for that? u32 is the exact width needed to perform
these computations, while unsigned int is something a bit unspecified.


> > +   /* Calculate and return the exact baud rate. */
> > +   baud = (baseline / mantissa) >> (exponent << 1);
> 
> You should handle division by zero here. It cannot currently happen as
> we cap the baudrate, but you should handle it here nonetheless. You
> can still assume a non-zero baudrate, though.
How about that?

mantissa = baseline / baud;
if (mantissa == 0)
        mantissa = 1;

Writing zero to the chip as it's currently done probably doesn't make
much sense anyway...
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to