linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] irqchip/mbigen: Fix incorrect null pointer check
@ 2024-02-19  8:53 陈骏
  2024-02-19  9:14 ` Greg KH
  2024-02-19 14:15 ` Thomas Gleixner
  0 siblings, 2 replies; 3+ messages in thread
From: 陈骏 @ 2024-02-19  8:53 UTC (permalink / raw)
  To: tglx, gregkh, linux-kernel; +Cc: xuqiang36, chenjun102

From: Chen Jun <chenjun102@huawei.com>

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

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

Fixes: fea087fc291b ("irqchip/mbigen: move to use bus_get_dev_root()")
Signed-off-by: Chen Jun <chenjun102@huawei.com>
---
v2: Modify change log
v1: https://lore.kernel.org/all/20240129130003.18181-1-chenjun102@huawei.com/

 drivers/irqchip/irq-mbigen.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
index 5101a3fb11df..58881d313979 100644
--- a/drivers/irqchip/irq-mbigen.c
+++ b/drivers/irqchip/irq-mbigen.c
@@ -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);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] irqchip/mbigen: Fix incorrect null pointer check
  2024-02-19  8:53 [PATCH v2] irqchip/mbigen: Fix incorrect null pointer check 陈骏
@ 2024-02-19  9:14 ` Greg KH
  2024-02-19 14:15 ` Thomas Gleixner
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2024-02-19  9:14 UTC (permalink / raw)
  To: 陈骏; +Cc: tglx, linux-kernel, xuqiang36

On Mon, Feb 19, 2024 at 04:53:14PM +0800, 陈骏 wrote:
> From: Chen Jun <chenjun102@huawei.com>
> 
> bus_get_dev_root returns sp->dev_root set in subsys_register.
> And subsys_register is not called by platform_bus_init.
> 
> For platform_bus_type, bus_get_dev_root always returns NULL.
> This makes mbigen_of_create_domain always return -ENODEV.
> 
> Fixes: fea087fc291b ("irqchip/mbigen: move to use bus_get_dev_root()")
> Signed-off-by: Chen Jun <chenjun102@huawei.com>
> ---


Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an
  older released kernel, yet you do not have a cc: stable line in the
  signed-off-by area at all, which means that the patch will not be
  applied to any older kernel releases.  To properly fix this, please
  follow the documented rules in the
  Documentation/process/stable-kernel-rules.rst file for how to resolve
  this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] irqchip/mbigen: Fix incorrect null pointer check
  2024-02-19  8:53 [PATCH v2] irqchip/mbigen: Fix incorrect null pointer check 陈骏
  2024-02-19  9:14 ` Greg KH
@ 2024-02-19 14:15 ` Thomas Gleixner
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2024-02-19 14:15 UTC (permalink / raw)
  To: 陈骏, gregkh, linux-kernel; +Cc: xuqiang36, chenjun102

Chen!

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

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@huawei.com>

Needs a

Cc: stable@vger.kernel.org

under the Signed-off-by tag.

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-19 14:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-19  8:53 [PATCH v2] irqchip/mbigen: Fix incorrect null pointer check 陈骏
2024-02-19  9:14 ` Greg KH
2024-02-19 14:15 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).