Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1646743 > unrolled thread

[PATCH v2 0/3] mmc: cavium: bug fixes for 4.12

Started byJan Glauber <jglauber@cavium.com>
First post2017-05-22 13:10 +0200
Last post2017-05-22 18:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/3] mmc: cavium: bug fixes for 4.12 Jan Glauber <jglauber@cavium.com> - 2017-05-22 13:10 +0200
    [PATCH v2 1/3] mmc: cavium: Prevent crash with incomplete DT Jan Glauber <jglauber@cavium.com> - 2017-05-22 13:20 +0200
    Re: [PATCH v2 0/3] mmc: cavium: bug fixes for 4.12 Ulf Hansson <ulf.hansson@linaro.org> - 2017-05-22 18:10 +0200

#1646743 — [PATCH v2 0/3] mmc: cavium: bug fixes for 4.12

FromJan Glauber <jglauber@cavium.com>
Date2017-05-22 13:10 +0200
Subject[PATCH v2 0/3] mmc: cavium: bug fixes for 4.12
Message-ID<tJTnP-4Xw-13@gated-at.bofh.it>
Changes to v1:
- Fixed platform device leak, apply fix also to Octeon driver
- Use mmc_regulator_get_supply

Jan Glauber (3):
  mmc: cavium: Prevent crash with incomplete DT
  of/platform: Make of_platform_device_destroy globally visible
  mmc: cavium: Fix probing race with regulator

 drivers/mmc/host/cavium-octeon.c   | 11 ++++++++++-
 drivers/mmc/host/cavium-thunderx.c |  6 ++++++
 drivers/mmc/host/cavium.c          | 25 ++++++++++---------------
 drivers/of/platform.c              |  3 ++-
 include/linux/of_platform.h        |  1 +
 5 files changed, 29 insertions(+), 17 deletions(-)

-- 
2.9.0.rc0.21.g7777322

[toc] | [next] | [standalone]


#1646748 — [PATCH v2 1/3] mmc: cavium: Prevent crash with incomplete DT

FromJan Glauber <jglauber@cavium.com>
Date2017-05-22 13:20 +0200
Subject[PATCH v2 1/3] mmc: cavium: Prevent crash with incomplete DT
Message-ID<tJTxw-50U-1@gated-at.bofh.it>
In reply to#1646743
In case the DT specifies neither a regulator nor a gpio
for the shared power the driver will crash accessing the regulator.
Prevent the crash by checking the regulator before use.

Use mmc_regulator_get_supply() instead of open coding the same
logic.

Signed-off-by: Jan Glauber <jglauber@cavium.com>
---
 drivers/mmc/host/cavium.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/cavium.c b/drivers/mmc/host/cavium.c
index 58b51ba..b8aaf0f 100644
--- a/drivers/mmc/host/cavium.c
+++ b/drivers/mmc/host/cavium.c
@@ -839,14 +839,14 @@ static void cvm_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 		cvm_mmc_reset_bus(slot);
 		if (host->global_pwr_gpiod)
 			host->set_shared_power(host, 0);
-		else
+		else if (!IS_ERR(mmc->supply.vmmc))
 			mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
 		break;
 
 	case MMC_POWER_UP:
 		if (host->global_pwr_gpiod)
 			host->set_shared_power(host, 1);
-		else
+		else if (!IS_ERR(mmc->supply.vmmc))
 			mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
 		break;
 	}
@@ -968,20 +968,15 @@ static int cvm_mmc_of_parse(struct device *dev, struct cvm_mmc_slot *slot)
 		return -EINVAL;
 	}
 
-	mmc->supply.vmmc = devm_regulator_get_optional(dev, "vmmc");
-	if (IS_ERR(mmc->supply.vmmc)) {
-		if (PTR_ERR(mmc->supply.vmmc) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-		/*
-		 * Legacy Octeon firmware has no regulator entry, fall-back to
-		 * a hard-coded voltage to get a sane OCR.
-		 */
+	ret = mmc_regulator_get_supply(mmc);
+	if (ret == -EPROBE_DEFER)
+		return ret;
+	/*
+	 * Legacy Octeon firmware has no regulator entry, fall-back to
+	 * a hard-coded voltage to get a sane OCR.
+	 */
+	if (IS_ERR(mmc->supply.vmmc))
 		mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
-	} else {
-		ret = mmc_regulator_get_ocrmask(mmc->supply.vmmc);
-		if (ret > 0)
-			mmc->ocr_avail = ret;
-	}
 
 	/* Common MMC bindings */
 	ret = mmc_of_parse(mmc);
-- 
2.9.0.rc0.21.g7777322

[toc] | [prev] | [next] | [standalone]


#1647093

FromUlf Hansson <ulf.hansson@linaro.org>
Date2017-05-22 18:10 +0200
Message-ID<tJY4a-7To-21@gated-at.bofh.it>
In reply to#1646743
On 22 May 2017 at 13:09, Jan Glauber <jglauber@cavium.com> wrote:
> Changes to v1:
> - Fixed platform device leak, apply fix also to Octeon driver
> - Use mmc_regulator_get_supply
>
> Jan Glauber (3):
>   mmc: cavium: Prevent crash with incomplete DT
>   of/platform: Make of_platform_device_destroy globally visible
>   mmc: cavium: Fix probing race with regulator
>
>  drivers/mmc/host/cavium-octeon.c   | 11 ++++++++++-
>  drivers/mmc/host/cavium-thunderx.c |  6 ++++++
>  drivers/mmc/host/cavium.c          | 25 ++++++++++---------------
>  drivers/of/platform.c              |  3 ++-
>  include/linux/of_platform.h        |  1 +
>  5 files changed, 29 insertions(+), 17 deletions(-)
>
> --
> 2.9.0.rc0.21.g7777322
>

Thanks, applied for fixes!

Kind regards
Uffe

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web