Skip to content

Commit 2bc552d

Browse files
bzolnierglikely
authored andcommitted
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 <b.zolnierkie@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Grant Likely <grant.likely@linaro.org>
1 parent d84ff46 commit 2bc552d

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

‎drivers/of/platform.c‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,11 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
264264
return NULL;
265265

266266
dev = amba_device_alloc(NULL, 0, 0);
267-
if (!dev)
267+
if (!dev) {
268+
pr_err("%s(): amba_device_alloc() failed for %s\n",
269+
__func__, node->full_name);
268270
return NULL;
271+
}
269272

270273
/* setup generic device info */
271274
dev->dev.coherent_dma_mask = ~0;
@@ -290,12 +293,18 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
290293
dev->irq[i] = irq_of_parse_and_map(node, i);
291294

292295
ret = of_address_to_resource(node, 0, &dev->res);
293-
if (ret)
296+
if (ret) {
297+
pr_err("%s(): of_address_to_resource() failed (%d) for %s\n",
298+
__func__, ret, node->full_name);
294299
goto err_free;
300+
}
295301

296302
ret = amba_device_add(dev, &iomem_resource);
297-
if (ret)
303+
if (ret) {
304+
pr_err("%s(): amba_device_add() failed (%d) for %s\n",
305+
__func__, ret, node->full_name);
298306
goto err_free;
307+
}
299308

300309
return dev;
301310

@@ -374,6 +383,10 @@ static int of_platform_bus_create(struct device_node *bus,
374383
}
375384

376385
if (of_device_is_compatible(bus, "arm,primecell")) {
386+
/*
387+
* Don't return an error here to keep compatibility with older
388+
* device tree files.
389+
*/
377390
of_amba_device_create(bus, bus_id, platform_data, parent);
378391
return 0;
379392
}

0 commit comments

Comments
 (0)