Parsing DT nodes if CONFIG_OFTREE isn't enabled is pointless, also
we should prefer potential platform_data passed earlier.
Protect mrvl_nand_probe_dt by bailing out early if either
CONFIG_OFTREE is not enabled or dev's platform_data is non-NULL.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Tested-by: Robert Jarzmik <[email protected]>
---
 drivers/mtd/nand/nand_mrvl_nfc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/nand/nand_mrvl_nfc.c b/drivers/mtd/nand/nand_mrvl_nfc.c
index ac530fc62499..95abd4ddf243 100644
--- a/drivers/mtd/nand/nand_mrvl_nfc.c
+++ b/drivers/mtd/nand/nand_mrvl_nfc.c
@@ -983,6 +983,9 @@ static int mrvl_nand_probe_dt(struct mrvl_nand_host *host)
 {
        struct device_node *np = host->dev->device_node;
 
+       if (!IS_ENABLED(CONFIG_OFTREE) || host->dev->platform_data)
+               return 0;
+
        if (of_get_property(np, "marvell,nand-keep-config", NULL))
                host->keep_config = 1;
        of_property_read_u32(np, "num-cs", &host->cs);
-- 
2.1.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to