All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "ASoC: pcm512x: Fix divide by zero issue" has been added to the 4.0-stable tree
@ 2015-05-02 17:01 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2015-05-02 17:01 UTC (permalink / raw)
  To: hm, broonie, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    ASoC: pcm512x: Fix divide by zero issue

to the 4.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-pcm512x-fix-divide-by-zero-issue.patch
and it can be found in the queue-4.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From f073faa73626f41db7050a69edd5074c53ce6d6c Mon Sep 17 00:00:00 2001
From: Howard Mitchell <hm@hmbedded.co.uk>
Date: Fri, 20 Mar 2015 21:13:45 +0000
Subject: ASoC: pcm512x: Fix divide by zero issue

From: Howard Mitchell <hm@hmbedded.co.uk>

commit f073faa73626f41db7050a69edd5074c53ce6d6c upstream.

If den=1 and pllin_rate>20MHz then den and num are adjusted to 0
causing a divide by zero error a few lines further on. Therefore
this patch correctly scales num and den such that
pllin_rate/den < 20MHz as required in the device data sheet.

Signed-off-by: Howard Mitchell <hm@hmbedded.co.uk>
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/soc/codecs/pcm512x.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/sound/soc/codecs/pcm512x.c
+++ b/sound/soc/codecs/pcm512x.c
@@ -576,8 +576,8 @@ static int pcm512x_find_pll_coeff(struct
 
 	/* pllin_rate / P (or here, den) cannot be greater than 20 MHz */
 	if (pllin_rate / den > 20000000 && num < 8) {
-		num *= 20000000 / (pllin_rate / den);
-		den *= 20000000 / (pllin_rate / den);
+		num *= DIV_ROUND_UP(pllin_rate / den, 20000000);
+		den *= DIV_ROUND_UP(pllin_rate / den, 20000000);
 	}
 	dev_dbg(dev, "num / den = %lu / %lu\n", num, den);
 


Patches currently in stable-queue which might be from hm@hmbedded.co.uk are

queue-4.0/asoc-pcm512x-add-analogue-prefix-to-analogue-volume-controls.patch
queue-4.0/asoc-pcm512x-fix-divide-by-zero-issue.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-05-02 17:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-02 17:01 Patch "ASoC: pcm512x: Fix divide by zero issue" has been added to the 4.0-stable tree gregkh

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.