From: Jonathan Cameron <jic23@kernel.org>
To: Duan Andy <fugang.duan@freescale.com>,
Fabio Estevam <Fabio.Estevam@freescale.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"festevam@gmail.com" <festevam@gmail.com>
Subject: Re: [PATCH] iio: adc: vf610: Avoid division by zero
Date: Sun, 8 Nov 2015 15:42:28 +0000 [thread overview]
Message-ID: <563F6D64.6070801@kernel.org> (raw)
In-Reply-To: <BN3PR0301MB1219ED45A2E049CDBB2DEEDBF52A0@BN3PR0301MB1219.namprd03.prod.outlook.com>
On 04/11/15 06:41, Duan Andy wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com> 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] [<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@freescale.com>
>> ---
>> 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@freescale.com>
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
>
next prev parent reply other threads:[~2015-11-08 15:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-03 16:18 [PATCH] iio: adc: vf610: Avoid division by zero Fabio Estevam
2015-11-04 6:41 ` Duan Andy
2015-11-08 15:42 ` Jonathan Cameron [this message]
2015-11-15 12:37 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=563F6D64.6070801@kernel.org \
--to=jic23@kernel.org \
--cc=Fabio.Estevam@freescale.com \
--cc=festevam@gmail.com \
--cc=fugang.duan@freescale.com \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.