diff mbox series

[3/8] mmc: let mmc_of_parse() fail for insane bus-width value

Message ID 1514566812-16781-4-git-send-email-yamada.masahiro@socionext.com
State Accepted
Commit 4b28f7bc930347cb99a6ee2f213ce9db34e36697
Headers show
Series mmc: some fixes for core and add HS200 support for sdhci-cadence | expand

Commit Message

Masahiro Yamada Dec. 29, 2017, 5 p.m. UTC
You must fix your DT if it specifies insane bus-width, for example,
  bus-width = <3>;

debug() is not displayed in usual configuration, so people will not
even notice weirdness.  Use dev_err() instead, then let it fail.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/mmc/mmc-uclass.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 37ce922..44c36dc 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -140,10 +140,8 @@  int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg)
 		cfg->host_caps |= MMC_MODE_1BIT;
 		break;
 	default:
-		debug("warning: %s invalid bus-width property. using 1-bit\n",
-		      dev_read_name(dev));
-		cfg->host_caps |= MMC_MODE_1BIT;
-		break;
+		dev_err(dev, "Invalid \"bus-width\" value %u!\n", val);
+		return -EINVAL;
 	}
 
 	/* f_max is obtained from the optional "max-frequency" property */