The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH next] irqchip/ls-scfg-msi: Fix NULL dereference in error handling
@ 2025-07-16 19:43 Dan Carpenter
  2025-07-16 19:58 ` Nam Cao
  2025-07-18 12:59 ` [tip: irq/drivers] " tip-bot2 for Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-07-16 19:43 UTC (permalink / raw)
  To: Nam Cao; +Cc: Thomas Gleixner, linux-kernel, kernel-janitors

The call to irq_domain_remove(msi_data->parent); was accidentally left
behind during a code refactor.  It's not necessary to free
"msi_data->parent" because it is NULL and, in fact, trying to free it
will lead to a NULL pointer dereference.  Delete the unnecessary code.

Fixes: 94b59d5f567a ("irqchip/ls-scfg-msi: Switch to use msi_create_parent_irq_domain()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/irqchip/irq-ls-scfg-msi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/irqchip/irq-ls-scfg-msi.c b/drivers/irqchip/irq-ls-scfg-msi.c
index 7eca751d6548..4910f364e568 100644
--- a/drivers/irqchip/irq-ls-scfg-msi.c
+++ b/drivers/irqchip/irq-ls-scfg-msi.c
@@ -226,7 +226,6 @@ static int ls_scfg_msi_domains_init(struct ls_scfg_msi *msi_data)
 	msi_data->parent = msi_create_parent_irq_domain(&info, &ls_scfg_msi_parent_ops);
 	if (!msi_data->parent) {
 		dev_err(&msi_data->pdev->dev, "failed to create MSI domain\n");
-		irq_domain_remove(msi_data->parent);
 		return -ENOMEM;
 	}
 
-- 
2.47.2


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

* Re: [PATCH next] irqchip/ls-scfg-msi: Fix NULL dereference in error handling
  2025-07-16 19:43 [PATCH next] irqchip/ls-scfg-msi: Fix NULL dereference in error handling Dan Carpenter
@ 2025-07-16 19:58 ` Nam Cao
  2025-07-18 12:59 ` [tip: irq/drivers] " tip-bot2 for Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Nam Cao @ 2025-07-16 19:58 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Thomas Gleixner, linux-kernel, kernel-janitors

On Wed, Jul 16, 2025 at 02:43:45PM -0500, Dan Carpenter wrote:
> The call to irq_domain_remove(msi_data->parent); was accidentally left
> behind during a code refactor.  It's not necessary to free
> "msi_data->parent" because it is NULL and, in fact, trying to free it
> will lead to a NULL pointer dereference.  Delete the unnecessary code.
> 
> Fixes: 94b59d5f567a ("irqchip/ls-scfg-msi: Switch to use msi_create_parent_irq_domain()")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Nam Cao <namcao@linutronix.de>

Thanks for the fix!
Nam

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

* [tip: irq/drivers] irqchip/ls-scfg-msi: Fix NULL dereference in error handling
  2025-07-16 19:43 [PATCH next] irqchip/ls-scfg-msi: Fix NULL dereference in error handling Dan Carpenter
  2025-07-16 19:58 ` Nam Cao
@ 2025-07-18 12:59 ` tip-bot2 for Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Dan Carpenter @ 2025-07-18 12:59 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Dan Carpenter, Thomas Gleixner, Nam Cao, x86, linux-kernel

The following commit has been merged into the irq/drivers branch of tip:

Commit-ID:     aabf4ff06b9789f3cd167bf9e2eb25f1fdb5541a
Gitweb:        https://git.kernel.org/tip/aabf4ff06b9789f3cd167bf9e2eb25f1fdb5541a
Author:        Dan Carpenter <dan.carpenter@linaro.org>
AuthorDate:    Wed, 16 Jul 2025 14:43:45 -05:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Fri, 18 Jul 2025 14:54:45 +02:00

irqchip/ls-scfg-msi: Fix NULL dereference in error handling

The call to irq_domain_remove(msi_data->parent); was accidentally left
behind during a code refactor.  It's not necessary to free
"msi_data->parent" because it is NULL and, in fact, trying to free it
will lead to a NULL pointer dereference.  Delete the unnecessary code.

Fixes: 94b59d5f567a ("irqchip/ls-scfg-msi: Switch to use msi_create_parent_irq_domain()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/all/15059507-6422-4333-94ca-e8e8840bd289@sabinyo.mountain

---
 drivers/irqchip/irq-ls-scfg-msi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/irqchip/irq-ls-scfg-msi.c b/drivers/irqchip/irq-ls-scfg-msi.c
index 7eca751..4910f36 100644
--- a/drivers/irqchip/irq-ls-scfg-msi.c
+++ b/drivers/irqchip/irq-ls-scfg-msi.c
@@ -226,7 +226,6 @@ static int ls_scfg_msi_domains_init(struct ls_scfg_msi *msi_data)
 	msi_data->parent = msi_create_parent_irq_domain(&info, &ls_scfg_msi_parent_ops);
 	if (!msi_data->parent) {
 		dev_err(&msi_data->pdev->dev, "failed to create MSI domain\n");
-		irq_domain_remove(msi_data->parent);
 		return -ENOMEM;
 	}
 

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

end of thread, other threads:[~2025-07-18 12:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-16 19:43 [PATCH next] irqchip/ls-scfg-msi: Fix NULL dereference in error handling Dan Carpenter
2025-07-16 19:58 ` Nam Cao
2025-07-18 12:59 ` [tip: irq/drivers] " tip-bot2 for Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox