On Thu, May 04, 2023 at 07:56:07PM +0800, Kefeng Wang wrote: > > > On 2023/5/4 15:34, Dan Carpenter wrote: > > Hello Greg Kroah-Hartman, > > > > The patch fea087fc291b: "irqchip/mbigen: move to use > > bus_get_dev_root()" from Mar 13, 2023, leads to the following Smatch > > static checker warning: > > > > drivers/irqchip/irq-mbigen.c:258 mbigen_of_create_domain() > > error: potentially dereferencing uninitialized 'child'. > > > > drivers/irqchip/irq-mbigen.c > > 235 static int mbigen_of_create_domain(struct platform_device *pdev, > > 236 struct mbigen_device *mgn_chip) > > 237 { > > 238 struct device *parent; > > 239 struct platform_device *child; > > 240 struct irq_domain *domain; > > 241 struct device_node *np; > > 242 u32 num_pins; > > 243 > > 244 for_each_child_of_node(pdev->dev.of_node, np) { > > 245 if (!of_property_read_bool(np, "interrupt-controller")) > > 246 continue; > > 247 > > 248 parent = bus_get_dev_root(&platform_bus_type); > > 249 if (parent) { > > > > Smatch is concerned that "parent" can be NULL. Probably unlikely in > > real life. > > How about move bus_get_dev_root() out of the loop. > Sounds good to me, but I don't know this code at all. regards, dan carpenter