irqchip/mbigen: Don't use bus_get_dev_root() to find the parent
commitfb33a46cd7upstream. 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:fea087fc29("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 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b0365460e9
commit
a9ab338683
@@ -235,22 +235,17 @@ static const struct irq_domain_ops mbigen_domain_ops = {
|
|||||||
static int mbigen_of_create_domain(struct platform_device *pdev,
|
static int mbigen_of_create_domain(struct platform_device *pdev,
|
||||||
struct mbigen_device *mgn_chip)
|
struct mbigen_device *mgn_chip)
|
||||||
{
|
{
|
||||||
struct device *parent;
|
|
||||||
struct platform_device *child;
|
struct platform_device *child;
|
||||||
struct irq_domain *domain;
|
struct irq_domain *domain;
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
u32 num_pins;
|
u32 num_pins;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
parent = bus_get_dev_root(&platform_bus_type);
|
|
||||||
if (!parent)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
for_each_child_of_node(pdev->dev.of_node, np) {
|
for_each_child_of_node(pdev->dev.of_node, np) {
|
||||||
if (!of_property_read_bool(np, "interrupt-controller"))
|
if (!of_property_read_bool(np, "interrupt-controller"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
child = of_platform_device_create(np, NULL, parent);
|
child = of_platform_device_create(np, NULL, NULL);
|
||||||
if (!child) {
|
if (!child) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
break;
|
break;
|
||||||
@@ -273,7 +268,6 @@ static int mbigen_of_create_domain(struct platform_device *pdev,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
put_device(parent);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
of_node_put(np);
|
of_node_put(np);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user