irqchip/mbigen: Fix incorrect null pointer check
PATCH 1/1 irqchip/mbigen: Fix incorrect null pointer check
bus_get_dev_root(&platform_bus_type) always returns NULL. This makes mbigen_of_create_domain always return -ENODEV.
--- drivers/irqchip/irq-mbigen.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/irqchip/irq-mbigen.c +1 -7
@@ -235,22 +235,17 @@ static const struct irq_domain_ops mbigen_domain_ops = {static int mbigen_of_create_domain (struct platform_device *pdev,struct mbigen_device *mgn_chip) { -struct device *parent;struct platform_device *child;struct irq_domain *domain;struct device_node *np;u32 num_pins;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) {if (!of_property_read_bool (np,"interrupt-controller" ))continue ; - child =of_platform_device_create (np,NULL , parent); + child =of_platform_device_create (np,NULL ,NULL );if (!child) { ret = -ENOMEM ;break ;
@@ -273,7 +268,6 @@ static int mbigen_of_create_domain(struct platform_device *pdev, } } -put_device (parent);if (ret)of_node_put (np);
Signature · 1 line
2.17.1
On Mon, Jan 29 2024 at 21:00, Chen Jun wrote:
That's not about an incorrect NULL pointer check. That's about using a function which is guaranteed to return NULL on your platform, no?
Quoted 1 line
bus_get_dev_root(&platform_bus_type)always returns NULL.
Lacks an explanation why this always returns NULL.
Thanks
tglx
Quoted 4 lines · Chen Jun
bus_get_dev_root(&platform_bus_type)always returns NULL. This makesmbigen_of_create_domainalways return-ENODEV.Fixes fea087fc291b ("irqchip/mbigen: move to use bus_get_dev_root()")
Amazing that it took 9 month to figure that out ...
Quoted 9 lines · Thomas Gleixner
On Mon, Jan 29 2024 at 21:00, Chen Jun wrote:
That's not about an incorrect NULL pointer check. That's about using a function which is guaranteed to return NULL on your platform, no?
Quoted 1 line
bus_get_dev_root(&platform_bus_type)always returns NULL.Lacks an explanation why this always returns NULL.
Thank you for the reply.
bus_get_dev_root returns sp->dev_root set in subsys_register. And subsys_register is not called by platform_bus_init.
So, for platform_bus_type, bus_get_dev_root always returns NULL.
Quoted 5 lines
Thanks
tglx
Quoted 11 lines · chenjun (AM)
Quoted 9 lines · Thomas Gleixner
On Mon, Jan 29 2024 at 21:00, Chen Jun wrote:
That's not about an incorrect NULL pointer check. That's about using a function which is guaranteed to return NULL on your platform, no?
Quoted 1 line
bus_get_dev_root(&platform_bus_type)always returns NULL.Lacks an explanation why this always returns NULL.
Quoted 6 lines
Thank you for the reply.
bus_get_dev_rootreturnssp->dev_rootset insubsys_register. Andsubsys_registeris not called byplatform_bus_init.So, for
platform_bus_type,bus_get_dev_rootalways returns NULL.
Please add this information to the change log.
Thanks,
tglx