From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from saturn.retrosnub.co.uk ([178.18.118.26]:43831 "EHLO saturn.retrosnub.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751897AbbKHPmb (ORCPT ); Sun, 8 Nov 2015 10:42:31 -0500 Subject: Re: [PATCH] iio: adc: vf610: Avoid division by zero To: Duan Andy , Fabio Estevam References: <1446567530-14725-1-git-send-email-fabio.estevam@freescale.com> Cc: "linux-iio@vger.kernel.org" , "festevam@gmail.com" From: Jonathan Cameron Message-ID: <563F6D64.6070801@kernel.org> Date: Sun, 8 Nov 2015 15:42:28 +0000 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Sender: linux-iio-owner@vger.kernel.org List-Id: linux-iio@vger.kernel.org On 04/11/15 06:41, Duan Andy wrote: > From: Fabio Estevam Sent: Wednesday, November 04, 2015 12:19 AM >> To: jic23@kernel.org >> Cc: Duan Fugang-B38611; linux-iio@vger.kernel.org; festevam@gmail.com; >> 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] [] (dump_backtrace) from [] >> (show_stack+0x18/0x1c) >> [ 2.212730] r6:ef138410 r5:00000000 r4:00000000 r3:00000000 >> [ 2.218494] [] (show_stack) from [] >> (dump_stack+0x88/0xa4) >> [ 2.225756] [] (dump_stack) from [] >> (__div0+0x18/0x20) >> [ 2.232636] r5:00000001 r4:eeb0a800 >> [ 2.236286] [] (__div0) from [] (Ldiv0+0x8/0x10) >> [ 2.242657] [] (vf610_adc_probe) from [] >> (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 >> --- >> 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 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@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >