Re: [PATCH] iio: adc: vf610: Avoid division by zero

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

 



On 04/11/15 06:41, Duan Andy wrote:
> From: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx> Sent: Wednesday, November 04, 2015 12:19 AM
>> To: jic23@xxxxxxxxxx
>> Cc: Duan Fugang-B38611; linux-iio@xxxxxxxxxxxxxxx; festevam@xxxxxxxxx;
>> Estevam Fabio-R49496
>> Subject: [PATCH] iio: adc: vf610: Avoid division by zero
>>
>> When the 'adck-max-frequency' property is not passed in device tree, the
>> following division by zero is seen:
>>
>> [    2.196814] Hardware name: Freescale i.MX6 SoloX (Device Tree)
>> [    2.202652] Backtrace:
>> [    2.205156] [<c0013600>] (dump_backtrace) from [<c001379c>]
>> (show_stack+0x18/0x1c)
>> [    2.212730]  r6:ef138410 r5:00000000 r4:00000000 r3:00000000
>> [    2.218494] [<c0013784>] (show_stack) from [<c02d8220>]
>> (dump_stack+0x88/0xa4)
>> [    2.225756] [<c02d8198>] (dump_stack) from [<c001346c>]
>> (__div0+0x18/0x20)
>> [    2.232636]  r5:00000001 r4:eeb0a800
>> [    2.236286] [<c0013454>] (__div0) from [<c02d6be4>] (Ldiv0+0x8/0x10)
>> [    2.242657] [<c0574574>] (vf610_adc_probe) from [<c03c9274>]
>> (platform_drv_probe+0x58/0xb4)
>>
>> Provide a sane adck_rate default value that can be used in normal, high-
>> speed and low-power modes in the case of 'adck-max-frequency' property
>> being absent.
>>
>> Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
>> ---
>>  drivers/iio/adc/vf610_adc.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c
>> index 599cde3..424fd69 100644
>> --- a/drivers/iio/adc/vf610_adc.c
>> +++ b/drivers/iio/adc/vf610_adc.c
>> @@ -105,6 +105,7 @@
>>  #define VF610_ADC_TIMEOUT		msecs_to_jiffies(100)
>>
>>  #define DEFAULT_SAMPLE_TIME		1000
>> +#define ADCK_RATE_MAX_DEFAULT		20000000
>>
>>  enum clk_sel {
>>  	VF610_ADCIOC_BUSCLK_SET,
>> @@ -195,6 +196,7 @@ static inline void vf610_adc_calculate_rates(struct
>> vf610_adc *info)
>>  	} else {
>>  		/* fall-back value using a safe divisor */
>>  		adc_feature->clk_div = 8;
>> +		adck_rate = ADCK_RATE_MAX_DEFAULT;
>>  	}
>>
>>  	/*
>> --
>> 1.9.1
> 
> Acked-by: Fugang Duan <B38611@xxxxxxxxxxxxx>
Applied to the fixes-togreg branch of iio.git - marked for stable.

Thanks,

Jonathan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux