Re: [PATCH 5/5] i2c: riic: avoid potential division by zero

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

 



> > -	total_ticks = DIV_ROUND_UP(rate, t->bus_freq_hz);
> > +	total_ticks = DIV_ROUND_UP(rate, t->bus_freq_hz ?: 1);
> 
> Not sure clamping function min_t/min(t->bus_freq_hz, 1)
> Or ternary condition is good in this case for avoiding potential division by 0?

Both work. I chose the ternary because I believe it involves less
computation and a tad tighter syntax.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux