[U-Boot] [PATCH 6/8] dm: mmc: Check that drivers have operations

Simon Glass sjg at chromium.org
Mon Apr 24 02:02:09 UTC 2017


When binding a new MMC device, make sure that it has the required
operations. Since for now we still support *not* having the operations
(with CONFIG_DM_MMC_OPS not enabled) it makes sense to add this check.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 drivers/mmc/mmc-uclass.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 1a84a033ae..ae0e22dfeb 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -198,6 +198,10 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
 	struct udevice *bdev;
 	int ret, devnum = -1;
 
+#ifdef CONFIG_DM_MMC_OPS
+	if (!mmc_get_ops(dev))
+		return -ENOSYS;
+#endif
 #ifndef CONFIG_SPL_BUILD
 	/* Use the fixed index with aliase node's index */
 	fdtdec_get_alias_seq(gd->fdt_blob, "mmc", dev->of_offset, &devnum);
-- 
2.12.2.816.g2cccc81164-goog



More information about the U-Boot mailing list