Re: [PATCH v2] irqchip/mbigen: Fix incorrect null pointer check

From: Thomas Gleixner
Date: Mon Feb 19 2024 - 09:15:20 EST


Chen!

On Mon, Feb 19 2024 at 16:53, 陈骏 wrote:
> From: Chen Jun <chenjun102@xxxxxxxxxx>

As I said before, the subject line does not make sense. This is not
about an incorrect NULL pointer check. It's about using a function which
is guaranteed to return NULL on your platform. Something like:

irqchip/mbigen: Don't use bus_get_dev_root() to find the parent

makes it pretty clear what this is about.

> bus_get_dev_root returns sp->dev_root set in subsys_register.
> And subsys_register is not called by platform_bus_init.

Please use '()' when referencing functions. See:

https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#function-references-in-changelogs

> For platform_bus_type, bus_get_dev_root always returns NULL.
> This makes mbigen_of_create_domain always return -ENODEV.

This lacks an information how the above problem is solved,
i.e. something like:

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.

Hmm?

> Fixes: fea087fc291b ("irqchip/mbigen: move to use bus_get_dev_root()")
> Signed-off-by: Chen Jun <chenjun102@xxxxxxxxxx>

Needs a

Cc: stable@xxxxxxxxxxxxxxx

under the Signed-off-by tag.

Thanks,

tglx