On Thu, Jul 23, 2015 at 04:21:36PM +0200, Michał Pecio wrote: > > > > + 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. Because you don't need a specific size (e.g. for marshalling). You can safely assume an int is at least 32 bits. > > > + /* 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... Sure, that works. Thanks, Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html