All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: intel_ips: Remove unnecessary NULL check before debugfs_remove_recursive
@ 2018-12-06  1:09 Wen Yang
  2018-12-06  2:37 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Wen Yang @ 2018-12-06  1:09 UTC (permalink / raw)
  To: Darren Hart, Andy Shevchenko
  Cc: platform-driver-x86, linux-kernel, zhong.weidong, Wen Yang

debugfs_remove_recursive() accepts a NULL parameter and returns
immediately, there's no need for a NULL check in the caller.

This issue was detected with the help of Coccinelle.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
CC: Darren Hart <dvhart@infradead.org>
CC: Andy Shevchenko <andy@infradead.org>
CC: platform-driver-x86@vger.kernel.org
CC: linux-kernel@vger.kernel.org
---
 drivers/platform/x86/intel_ips.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index 225638a1b09e..f8175b972537 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -1300,9 +1300,7 @@ static const struct file_operations ips_debugfs_ops = {
 
 static void ips_debugfs_cleanup(struct ips_driver *ips)
 {
-	if (ips->debug_root)
-		debugfs_remove_recursive(ips->debug_root);
-	return;
+	debugfs_remove_recursive(ips->debug_root);
 }
 
 static void ips_debugfs_init(struct ips_driver *ips)
-- 
2.19.1


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

* Re: [PATCH] platform/x86: intel_ips: Remove unnecessary NULL check before debugfs_remove_recursive
  2018-12-06  1:09 [PATCH] platform/x86: intel_ips: Remove unnecessary NULL check before debugfs_remove_recursive Wen Yang
@ 2018-12-06  2:37 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2018-12-06  2:37 UTC (permalink / raw)
  To: wen.yang99
  Cc: Darren Hart, Andy Shevchenko, Platform Driver,
	Linux Kernel Mailing List, zhong.weidong

On Thu, Dec 6, 2018 at 3:09 AM Wen Yang <wen.yang99@zte.com.cn> wrote:
>
> debugfs_remove_recursive() accepts a NULL parameter and returns
> immediately, there's no need for a NULL check in the caller.
>
> This issue was detected with the help of Coccinelle.
>

Thank you, similar patch is already in my queue.

> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> CC: Darren Hart <dvhart@infradead.org>
> CC: Andy Shevchenko <andy@infradead.org>
> CC: platform-driver-x86@vger.kernel.org
> CC: linux-kernel@vger.kernel.org
> ---
>  drivers/platform/x86/intel_ips.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
> index 225638a1b09e..f8175b972537 100644
> --- a/drivers/platform/x86/intel_ips.c
> +++ b/drivers/platform/x86/intel_ips.c
> @@ -1300,9 +1300,7 @@ static const struct file_operations ips_debugfs_ops = {
>
>  static void ips_debugfs_cleanup(struct ips_driver *ips)
>  {
> -       if (ips->debug_root)
> -               debugfs_remove_recursive(ips->debug_root);
> -       return;
> +       debugfs_remove_recursive(ips->debug_root);
>  }
>
>  static void ips_debugfs_init(struct ips_driver *ips)
> --
> 2.19.1
>


-- 
With Best Regards,
Andy Shevchenko

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

end of thread, other threads:[~2018-12-06  2:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06  1:09 [PATCH] platform/x86: intel_ips: Remove unnecessary NULL check before debugfs_remove_recursive Wen Yang
2018-12-06  2:37 ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.