Skip to contentSkip to conversation

MIPS: SGI-IP27: Delete an unnecessary check before kfree() in hub_domain_free()

PATCH Applied Markus Elfring 2 participants 2 messages Jun 10, 2025 – Jul 16, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: SGI-IP27: Delete an unnecessary check before kfree() in hub_domain_free()

From: Markus Elfring <[email protected]>
Date: Tue, 10 Jun 2025 11:44:20 +0200

It can be known that the function “kfree” performs a null pointer check for its input parameter.
It is therefore not needed to repeat such a check before its call.

Thus remove a redundant pointer check.

The source code was transformed by using the Coccinelle software.

---
 arch/mips/sgi-ip27/ip27-irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/sgi-ip27/ip27-irq.c +1 -1
index 288d4d17eddd..20ef663af16e 100644
@@ -165,7 +165,7 @@ static void hub_domain_free(struct irq_domain *domain,
 		return;
 
 	irqd = irq_domain_get_irq_data(domain, virq);
-	if (irqd && irqd->chip_data)
+	if (irqd)
 		kfree(irqd->chip_data);
 }
 
Signature · 1 line
2.49.0
maintainer Applied
#1 lore raw
Quoted 31 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Tue, 10 Jun 2025 11:44:20 +0200

It can be known that the function “kfree” performs a null pointer check for its input parameter.
It is therefore not needed to repeat such a check before its call.

Thus remove a redundant pointer check.

The source code was transformed by using the Coccinelle software.

---
 arch/mips/sgi-ip27/ip27-irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/sgi-ip27/ip27-irq.c +1 -1
index 288d4d17eddd..20ef663af16e 100644
@@ -165,7 +165,7 @@ static void hub_domain_free(struct irq_domain *domain,
 		return;
 
 	irqd = irq_domain_get_irq_data(domain, virq);
-	if (irqd && irqd->chip_data)
+	if (irqd)
 		kfree(irqd->chip_data);
 }
 
Signature · 1 line
2.49.0

applied to mips-next.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]