From: Pratyush Yadav <p.yadav@ti.com>
To: Yoshitaka Ikeda <ikeda@nskint.co.jp>
Cc: Mark Brown <broonie@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
Masahiro Mizutani <m.mizutani@nskint.co.jp>,
Ken Kurematsu <k.kurematsu@nskint.co.jp>
Subject: Re: [PATCH v4 2/2] spi: spi-cadence-quadspi: Fix division by zero warning
Date: Fri, 16 Jul 2021 12:56:46 +0530 [thread overview]
Message-ID: <20210716072644.a2qz345zphakoq4e@ti.com> (raw)
In-Reply-To: <958bb93b-db83-b685-5fa1-8e5dc40a5975@nskint.co.jp>
On 16/07/21 03:08AM, Yoshitaka Ikeda wrote:
> Fix below division by zero warning:
> - The reason for dividing by zero is because the dummy bus width is zero,
> but if the dummy n bytes is zero, it indicates that there is no data transfer,
> so we can just return zero without doing any calculations.
>
> [ 0.795337] Division by zero in kernel.
> :
> [ 0.834051] [<807fd40c>] (__div0) from [<804e1acc>] (Ldiv0+0x8/0x10)
> [ 0.839097] [<805f0710>] (cqspi_exec_mem_op) from [<805edb4c>] (spi_mem_exec_op+0x3b0/0x3f8)
>
> Fixes: 7512eaf54190 ("spi: cadence-quadspi: Fix dummy cycle calculation when buswidth > 1")
> Signed-off-by: Yoshitaka Ikeda <ikeda@nskint.co.jp>
Thanks.
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
> ---
> drivers/spi/spi-cadence-quadspi.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
> index 7a00346ff9b9..d62d69dd72b9 100644
> --- a/drivers/spi/spi-cadence-quadspi.c
> +++ b/drivers/spi/spi-cadence-quadspi.c
> @@ -309,6 +309,9 @@ static unsigned int cqspi_calc_dummy(const struct spi_mem_op *op, bool dtr)
> {
> unsigned int dummy_clk;
>
> + if (!op->dummy.nbytes)
> + return 0;
> +
> dummy_clk = op->dummy.nbytes * (8 / op->dummy.buswidth);
> if (dtr)
> dummy_clk /= 2;
> --
> 2.32.0
--
Regards,
Pratyush Yadav
Texas Instruments Inc.
prev parent reply other threads:[~2021-07-16 7:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-16 3:05 [PATCH v4 0/2] spi: spi-cadence-quadspi: Fix division by zero warning Yoshitaka Ikeda
2021-07-16 3:07 ` [PATCH v4 1/2] spi: spi-cadence-quadspi: Revert "Fix division by zero warning" Yoshitaka Ikeda
2021-07-16 7:27 ` Pratyush Yadav
2021-07-16 12:23 ` Mark Brown
2021-07-16 14:26 ` Yoshitaka Ikeda
2021-07-16 3:08 ` [PATCH v4 2/2] spi: spi-cadence-quadspi: Fix division by zero warning Yoshitaka Ikeda
2021-07-16 7:26 ` Pratyush Yadav [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=20210716072644.a2qz345zphakoq4e@ti.com \
--to=p.yadav@ti.com \
--cc=broonie@kernel.org \
--cc=ikeda@nskint.co.jp \
--cc=k.kurematsu@nskint.co.jp \
--cc=linux-spi@vger.kernel.org \
--cc=m.mizutani@nskint.co.jp \
--cc=p.zabel@pengutronix.de \
/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