From: Bartlomiej Zolnierkiewicz Date: Fri, 30 Aug 2013 11:17:29 +0000 (+0200) Subject: of/platform: add error reporting to of_amba_device_create() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2bc552df76d83cf1455ac8cf4c87615bfd15df74;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git of/platform: add error reporting to of_amba_device_create() Add error reporting to of_amba_device_create() so the user knows when (and why) some device tree nodes fail to initialize. [ The issue was spotted on Universal C210 board (using revision 0 of ARM Exynos4210 SoC) on which initialization was silently failing for PL330 MDMA1 device tree node (it was using the wrong addres resulting in amba_device_add() returning -ENODEV). ] Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Kyungmin Park Signed-off-by: Grant Likely --- diff --git a/drivers/of/platform.c b/drivers/of/platform.c index b0d1ff8b0991..f6dcde220821 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -264,8 +264,11 @@ static struct amba_device *of_amba_device_create(struct device_node *node, return NULL; dev = amba_device_alloc(NULL, 0, 0); - if (!dev) + if (!dev) { + pr_err("%s(): amba_device_alloc() failed for %s\n", + __func__, node->full_name); return NULL; + } /* setup generic device info */ dev->dev.coherent_dma_mask = ~0; @@ -290,12 +293,18 @@ static struct amba_device *of_amba_device_create(struct device_node *node, dev->irq[i] = irq_of_parse_and_map(node, i); ret = of_address_to_resource(node, 0, &dev->res); - if (ret) + if (ret) { + pr_err("%s(): of_address_to_resource() failed (%d) for %s\n", + __func__, ret, node->full_name); goto err_free; + } ret = amba_device_add(dev, &iomem_resource); - if (ret) + if (ret) { + pr_err("%s(): amba_device_add() failed (%d) for %s\n", + __func__, ret, node->full_name); goto err_free; + } return dev; @@ -374,6 +383,10 @@ static int of_platform_bus_create(struct device_node *bus, } if (of_device_is_compatible(bus, "arm,primecell")) { + /* + * Don't return an error here to keep compatibility with older + * device tree files. + */ of_amba_device_create(bus, bus_id, platform_data, parent); return 0; }