提交 06220b89 编写于 作者: L Lars-Peter Clausen 提交者: Jonathan Cameron

staging:iio:adis16400: Don't pass 0 to ilog2

ilog2 is not defined for 0, so we need to handle the case where the requested
frequency is larger than the base sampling rate. In this case we'll round down
and set the sampling rate to the base sampling rate.
Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 3f6a0bad
......@@ -178,7 +178,11 @@ static int adis16334_set_freq(struct iio_dev *indio_dev, unsigned int freq)
{
unsigned int t;
t = ilog2(8192 / (freq * 10));
freq *= 10;
if (freq < 8192)
t = ilog2(8192 / freq);
else
t = 0;
if (t > 0x31)
t = 0x31;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册