]> git.sur5r.net Git - u-boot/commitdiff
dm: mmc: Check that drivers have operations
authorSimon Glass <sjg@chromium.org>
Mon, 24 Apr 2017 02:02:09 +0000 (20:02 -0600)
committerSimon Glass <sjg@chromium.org>
Thu, 1 Jun 2017 13:03:05 +0000 (07:03 -0600)
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@chromium.org>
drivers/mmc/mmc-uclass.c

index 8d03ec67c1d5711cbf83aab7c7c26f17d5eb2a9c..c9b6364260e854df6b0eb69c15d40947474d0546 100644 (file)
@@ -196,6 +196,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(dev), &devnum);