Skip to contentSkip to conversation

Patch "ASoC: pcm512x: Fix divide by zero issue" has been added to the 4.0-stable tree

PATCH [email protected] 1 participant 1 message May 2, 2015

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

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 <[email protected]> know about it.

Quoted 1 line

From f073faa73626f41db7050a69edd5074c53ce6d6c Mon Sep 17 00:00:00 2001

From: Howard Mitchell <[email protected]>
Date: Fri, 20 Mar 2015 21:13:45 +0000
Subject: ASoC: pcm512x: Fix divide by zero issue

From: Howard Mitchell <[email protected]>

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.

---
 sound/soc/codecs/pcm512x.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/pcm512x.c +2 -2
@@ -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 [email protected] 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