[U-Boot] [PATCH V2] mmc: mmc_legacy: fix the compiler error with disabled CONFIG_DM_MMC_OPS

To prevent the compiler error, split the checking condition whether cfg->ops is NULL or not. It's more clearly, because it's not included in mmc_config structure when CONFIG_DM_MMC_OPS is disabled.
drivers/mmc/mmc_legacy.c: In function ‘mmc_create’: drivers/mmc/mmc_legacy.c:118:31: error: ‘const struct mmc_config’ has no member named ‘ops’ drivers/mmc/mmc_legacy.c:118:58: error: ‘const struct mmc_config’ has no member named ‘ops’ make[1]: *** [drivers/mmc/mmc_legacy.o] Error 1
Signed-off-by: Jaehoon Chung jh80.chung@samsung.com --- Changes for V2: - Fixed the wrong condition checking
drivers/mmc/mmc_legacy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/mmc_legacy.c b/drivers/mmc/mmc_legacy.c index 040728b..25361d1 100644 --- a/drivers/mmc/mmc_legacy.c +++ b/drivers/mmc/mmc_legacy.c @@ -115,10 +115,15 @@ struct mmc *mmc_create(const struct mmc_config *cfg, void *priv) struct mmc *mmc;
/* quick validation */ - if (cfg == NULL || cfg->ops == NULL || cfg->ops->send_cmd == NULL || - cfg->f_min == 0 || cfg->f_max == 0 || cfg->b_max == 0) + if (cfg == NULL || cfg->f_min == 0 || + cfg->f_max == 0 || cfg->b_max == 0) return NULL;
+#ifndef CONFIG_DM_MMC_OPS + if (cfg->ops == NULL || cfg->ops->send_cmd == NULL) + return NULL; +#endif + mmc = calloc(1, sizeof(*mmc)); if (mmc == NULL) return NULL;

On 11 August 2016 at 20:39, Jaehoon Chung jh80.chung@samsung.com wrote:
To prevent the compiler error, split the checking condition whether cfg->ops is NULL or not. It's more clearly, because it's not included in mmc_config structure when CONFIG_DM_MMC_OPS is disabled.
drivers/mmc/mmc_legacy.c: In function ‘mmc_create’: drivers/mmc/mmc_legacy.c:118:31: error: ‘const struct mmc_config’ has no member named ‘ops’ drivers/mmc/mmc_legacy.c:118:58: error: ‘const struct mmc_config’ has no member named ‘ops’ make[1]: *** [drivers/mmc/mmc_legacy.o] Error 1
Signed-off-by: Jaehoon Chung jh80.chung@samsung.com
Changes for V2: - Fixed the wrong condition checking
drivers/mmc/mmc_legacy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

Hi,
On 08/13/2016 02:20 AM, Simon Glass wrote:
On 11 August 2016 at 20:39, Jaehoon Chung jh80.chung@samsung.com wrote:
To prevent the compiler error, split the checking condition whether cfg->ops is NULL or not. It's more clearly, because it's not included in mmc_config structure when CONFIG_DM_MMC_OPS is disabled.
drivers/mmc/mmc_legacy.c: In function ‘mmc_create’: drivers/mmc/mmc_legacy.c:118:31: error: ‘const struct mmc_config’ has no member named ‘ops’ drivers/mmc/mmc_legacy.c:118:58: error: ‘const struct mmc_config’ has no member named ‘ops’ make[1]: *** [drivers/mmc/mmc_legacy.o] Error 1
Signed-off-by: Jaehoon Chung jh80.chung@samsung.com
Changes for V2: - Fixed the wrong condition checking
drivers/mmc/mmc_legacy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied on u-boot-mmc. Thanks!
Best Regards, Jaehoon Chung
participants (2)
-
Jaehoon Chung
-
Simon Glass