linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Cc: sakari.ailus@iki.fi, sre@kernel.org, pali.rohar@gmail.com,
	linux-media@vger.kernel.org, galak@codeaurora.org,
	mchehab@osg.samsung.com, linux-kernel@vger.kernel.org
Subject: v4.9-rc1: smiapp divides by zero
Date: Sun, 23 Oct 2016 12:22:13 +0200	[thread overview]
Message-ID: <20161023102213.GA13705@amd> (raw)
In-Reply-To: <20161023073322.GA3523@amd>

[-- Attachment #1: Type: text/plain, Size: 1180 bytes --]

Hi!

I tried to update camera code on n900 to v4.9-rc1, and I'm getting
some divide by zero, that eventually cascades into fcam-dev not
working.

mul is zero in my testing, resulting in divide by zero.

(Note that this is going from my patched camera-v4.8 tree to
camera-v4.9 tree.)

Best regards,
								Pavel

diff --git a/drivers/media/i2c/smiapp-pll.c b/drivers/media/i2c/smiapp-pll.c
index 5ad1edb..e0a6edd 100644
--- a/drivers/media/i2c/smiapp-pll.c
+++ b/drivers/media/i2c/smiapp-pll.c
@@ -16,6 +16,8 @@
  * General Public License for more details.
  */
 
+#define DEBUG
+
 #include <linux/device.h>
 #include <linux/gcd.h>
 #include <linux/lcm.h>
@@ -457,6 +459,10 @@ int smiapp_pll_calculate(struct device *dev,
 	i = gcd(pll->pll_op_clk_freq_hz, pll->ext_clk_freq_hz);
 	mul = div_u64(pll->pll_op_clk_freq_hz, i);
 	div = pll->ext_clk_freq_hz / i;
+	if (!mul) {
+		dev_err(dev, "forcing mul to 1\n");
+		mul = 1;
+	}
 	dev_dbg(dev, "mul %u / div %u\n", mul, div);
 
 	min_pre_pll_clk_div =

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  reply	other threads:[~2016-10-23 10:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-11 15:39 [PATCH v3 0/2] media: add et8ek8 camera sensor driver and documentation Ivaylo Dimitrov
2016-06-11 15:39 ` [PATCH v3 1/2] media: Driver for Toshiba et8ek8 5MP sensor Ivaylo Dimitrov
2016-06-18 15:22   ` Pavel Machek
2016-06-18 15:37     ` Pali Rohár
2016-06-18 16:04       ` Pavel Machek
2016-06-18 16:11         ` Pali Rohár
2016-06-20 21:59       ` Sakari Ailus
2016-06-11 15:39 ` [PATCH v3 2/2] media: et8ek8: Add documentation Ivaylo Dimitrov
2016-06-14 22:05   ` Rob Herring
2016-06-15  4:31     ` Sakari Ailus
2016-06-15 18:41       ` Rob Herring
2016-06-15 19:24         ` Ivaylo Dimitrov
2016-06-18 14:36           ` Pavel Machek
2016-10-23  7:33 ` [PATCH v3 0/2] media: add et8ek8 camera sensor driver and documentation Pavel Machek
2016-10-23 10:22   ` Pavel Machek [this message]
2016-10-23 10:32     ` v4.9-rc1: smiapp divides by zero Pali Rohár
2016-10-23 10:52     ` Pavel Machek
2016-10-23 14:09     ` Sakari Ailus
2016-10-23 18:33       ` Pavel Machek
2016-10-23 18:05   ` [PATCH v3 0/2] media: add et8ek8 camera sensor driver and documentation Ivaylo Dimitrov
2016-10-23 18:17     ` Pavel Machek
2016-10-23 18:36       ` Ivaylo Dimitrov

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=20161023102213.GA13705@amd \
    --to=pavel@ucw.cz \
    --cc=galak@codeaurora.org \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=pali.rohar@gmail.com \
    --cc=sakari.ailus@iki.fi \
    --cc=sre@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;
as well as URLs for NNTP newsgroup(s).