linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: SGI-IP27: Delete an unnecessary check before kfree() in hub_domain_free()
@ 2025-06-10 10:28 Markus Elfring
  2025-07-16 18:04 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2025-06-10 10:28 UTC (permalink / raw)
  To: linux-mips, Jiri Slaby, Thomas Bogendörfer, Thomas Gleixner
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/mips/sgi-ip27/ip27-irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
index 288d4d17eddd..20ef663af16e 100644
--- a/arch/mips/sgi-ip27/ip27-irq.c
+++ b/arch/mips/sgi-ip27/ip27-irq.c
@@ -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);
 }
 
-- 
2.49.0


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

* Re: [PATCH] MIPS: SGI-IP27: Delete an unnecessary check before kfree() in hub_domain_free()
  2025-06-10 10:28 [PATCH] MIPS: SGI-IP27: Delete an unnecessary check before kfree() in hub_domain_free() Markus Elfring
@ 2025-07-16 18:04 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2025-07-16 18:04 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-mips, Jiri Slaby, Thomas Gleixner, LKML, kernel-janitors

On Tue, Jun 10, 2025 at 12:28:43PM +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  arch/mips/sgi-ip27/ip27-irq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
> index 288d4d17eddd..20ef663af16e 100644
> --- a/arch/mips/sgi-ip27/ip27-irq.c
> +++ b/arch/mips/sgi-ip27/ip27-irq.c
> @@ -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);
>  }
>  
> -- 
> 2.49.0

applied to mips-next.

Thomas.

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

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-10 10:28 [PATCH] MIPS: SGI-IP27: Delete an unnecessary check before kfree() in hub_domain_free() Markus Elfring
2025-07-16 18:04 ` Thomas Bogendoerfer

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).