linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Axel Lin <axel.lin@ingics.com>
Cc: linux-i2c@vger.kernel.org,
	"Uwe Kleine-König" <kernel@pengutronix.de>,
	"Wolfram Sang" <wsa@the-dreams.de>
Subject: Re: [PATCH] i2c: efm32: Prevent potential division by zero
Date: Thu, 14 Apr 2016 11:06:29 +0200	[thread overview]
Message-ID: <20160414090629.GO10108@pengutronix.de> (raw)
In-Reply-To: <CAFRkauC4YeuewDGRWbhhBWCG=XbMuNyNL+Lj2jv-nb5EWzaO-Q@mail.gmail.com>

Hello Axel,

On Thu, Apr 14, 2016 at 04:29:42PM +0800, Axel Lin wrote:
> 2016-04-14 16:24 GMT+08:00 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> > On Thu, Apr 14, 2016 at 03:42:54PM +0800, Axel Lin wrote:
> >> Make sure we don't OOPS in case clock-frequency is set to 0 in a DT. The
> >> variable set here is later used as a divisor.
> >
> > This is correct in principle. I thought it's ok to misbehave if the DT
> > is broken? In this case the current code is just fine.
> 
> Current code hit division by zero if clock-frequency is 0.
> clkdiv = DIV_ROUND_UP(rate, 8 * ddata->frequency) - 1;
> Is it ok?

IMHO yes. If you give the kernel a broken dt it's ok that the kernel is
broken then.

So if you want, take my:

	Registered-but-considered-unimportant-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

:-)

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

      reply	other threads:[~2016-04-14  9:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-14  7:42 [PATCH] i2c: efm32: Prevent potential division by zero Axel Lin
2016-04-14  8:24 ` Uwe Kleine-König
2016-04-14  8:29   ` Axel Lin
2016-04-14  9:06     ` Uwe Kleine-König [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=20160414090629.GO10108@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=axel.lin@ingics.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=wsa@the-dreams.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;
as well as URLs for NNTP newsgroup(s).