Skip to content

Commit eeeebf8

Browse files
ukleineknunojsa
authored andcommitted
iio: adc: ad_pulsar: Clamp freq to values > 0
freq is used as a divisor, so better don't let it be zero. Fixes: 44ffabe ("drivers: iio: adc: ad_pulsar: Add support for pulsar ADC's") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
1 parent 89d6d85 commit eeeebf8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iio/adc/ad_pulsar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ static int ad_pulsar_set_samp_freq(struct ad_pulsar_adc *adc, int freq)
427427
struct pwm_state cnv_state;
428428
int ret;
429429

430-
freq = clamp(freq, 0, adc->info->max_rate);
430+
freq = clamp(freq, 1, adc->info->max_rate);
431431
target = DIV_ROUND_CLOSEST_ULL(adc->ref_clk_rate, freq);
432432
ref_clk_period_ps = DIV_ROUND_CLOSEST_ULL(1000000000000,
433433
adc->ref_clk_rate);

0 commit comments

Comments
 (0)