if (!of_property_read_bool(np, "interrupt-controller"))
continue;
- parent = platform_bus_type.dev_root;
- child = of_platform_device_create(np, NULL, parent);
- if (!child) {
- of_node_put(np);
- return -ENOMEM;
+ parent = bus_get_dev_root(&platform_bus_type);
+ if (parent) {
+ child = of_platform_device_create(np, NULL, parent);
+ put_device(parent);
+ if (!child) {
+ of_node_put(np);
+ return -ENOMEM;
+ }
}
if (of_property_read_u32(child->dev.of_node, "num-pins",