Skip to content

Commit fb33a46

Browse files
Chen JunKAGA-KOKO
authored andcommitted
irqchip/mbigen: Don't use bus_get_dev_root() to find the parent
bus_get_dev_root() returns sp->dev_root which is set in subsys_register(), but subsys_register() is not called by platform_bus_init(). Therefor for the platform_bus_type, bus_get_dev_root() always returns NULL. This makes mbigen_of_create_domain() always return -ENODEV. Don't try to retrieve the parent via bus_get_dev_root() and unconditionally hand a NULL pointer to of_platform_device_create() to fix this. Fixes: fea087f ("irqchip/mbigen: move to use bus_get_dev_root()") Signed-off-by: Chen Jun <chenjun102@huawei.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240220111429.110666-1-chenjun102@huawei.com
1 parent db744dd commit fb33a46

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

drivers/irqchip/irq-mbigen.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,22 +235,17 @@ static const struct irq_domain_ops mbigen_domain_ops = {
235235
static int mbigen_of_create_domain(struct platform_device *pdev,
236236
struct mbigen_device *mgn_chip)
237237
{
238-
struct device *parent;
239238
struct platform_device *child;
240239
struct irq_domain *domain;
241240
struct device_node *np;
242241
u32 num_pins;
243242
int ret = 0;
244243

245-
parent = bus_get_dev_root(&platform_bus_type);
246-
if (!parent)
247-
return -ENODEV;
248-
249244
for_each_child_of_node(pdev->dev.of_node, np) {
250245
if (!of_property_read_bool(np, "interrupt-controller"))
251246
continue;
252247

253-
child = of_platform_device_create(np, NULL, parent);
248+
child = of_platform_device_create(np, NULL, NULL);
254249
if (!child) {
255250
ret = -ENOMEM;
256251
break;
@@ -273,7 +268,6 @@ static int mbigen_of_create_domain(struct platform_device *pdev,
273268
}
274269
}
275270

276-
put_device(parent);
277271
if (ret)
278272
of_node_put(np);
279273

0 commit comments

Comments
 (0)