Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Fabio Estevam <fabio.estevam@freescale.com>
Cc: b38611@freescale.com, linux-iio@vger.kernel.org, festevam@gmail.com
Subject: Re: [PATCH] iio: adc: vf610: Avoid division by zero
Date: Sun, 15 Nov 2015 12:37:51 +0000	[thread overview]
Message-ID: <56487C9F.1070704@kernel.org> (raw)
In-Reply-To: <1446567530-14725-1-git-send-email-fabio.estevam@freescale.com>

On 03/11/15 16:18, Fabio Estevam wrote:
> 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>
Hi Fabio

Actually ended up with two different fixes for the same issue merged
so as this was the later one I've dropped it.

The other fix changed the code ordering to set the adck_rate using the default
divisor.
> ---
>  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;
>  	}
>  
>  	/*
> 


      parent reply	other threads:[~2015-11-15 12:37 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
2015-11-15 12:37 ` Jonathan Cameron [this message]

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=56487C9F.1070704@kernel.org \
    --to=jic23@kernel.org \
    --cc=b38611@freescale.com \
    --cc=fabio.estevam@freescale.com \
    --cc=festevam@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox