* Patch "mmc: atmel-mci: fix bad variable type for clkdiv" has been added to the 3.10-stable tree
@ 2015-06-03 2:49 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2015-06-03 2:49 UTC (permalink / raw)
To: ludovic.desroches, gregkh, ulf.hansson; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
mmc: atmel-mci: fix bad variable type for clkdiv
to the 3.10-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:
mmc-atmel-mci-fix-bad-variable-type-for-clkdiv.patch
and it can be found in the queue-3.10 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 60c8f783a18feb95ad967c87e9660caf09fb4700 Mon Sep 17 00:00:00 2001
From: Ludovic Desroches <ludovic.desroches@atmel.com>
Date: Wed, 6 May 2015 15:16:46 +0200
Subject: mmc: atmel-mci: fix bad variable type for clkdiv
From: Ludovic Desroches <ludovic.desroches@atmel.com>
commit 60c8f783a18feb95ad967c87e9660caf09fb4700 upstream.
clkdiv is declared as an u32 but it can be set to a negative value
causing a huge divisor value. Change its type to int to avoid this case.
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/atmel-mci.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -1295,7 +1295,7 @@ static void atmci_set_ios(struct mmc_hos
if (ios->clock) {
unsigned int clock_min = ~0U;
- u32 clkdiv;
+ int clkdiv;
spin_lock_bh(&host->lock);
if (!host->mode_reg) {
@@ -1320,7 +1320,12 @@ static void atmci_set_ios(struct mmc_hos
/* Calculate clock divider */
if (host->caps.has_odd_clk_div) {
clkdiv = DIV_ROUND_UP(host->bus_hz, clock_min) - 2;
- if (clkdiv > 511) {
+ if (clkdiv < 0) {
+ dev_warn(&mmc->class_dev,
+ "clock %u too fast; using %lu\n",
+ clock_min, host->bus_hz / 2);
+ clkdiv = 0;
+ } else if (clkdiv > 511) {
dev_warn(&mmc->class_dev,
"clock %u too slow; using %lu\n",
clock_min, host->bus_hz / (511 + 2));
Patches currently in stable-queue which might be from ludovic.desroches@atmel.com are
queue-3.10/mmc-atmel-mci-fix-bad-variable-type-for-clkdiv.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-06-03 2:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-03 2:49 Patch "mmc: atmel-mci: fix bad variable type for clkdiv" has been added to the 3.10-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.