linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / wakeup: fix ptr_ret.cocci warnings
  2019-07-23 14:03 [pm:bleeding-edge 21/23] drivers/base/power/wakeup_stats.c:143:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
@ 2019-07-23 14:03 ` kbuild test robot
  2019-07-23 16:27   ` Tri Vo
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2019-07-23 14:03 UTC (permalink / raw)
  To: Tri Vo
  Cc: kbuild-all, linux-acpi, devel, linux-pm, Rafael J. Wysocki,
	Greg Kroah-Hartman

From: kbuild test robot <lkp@intel.com>

drivers/base/power/wakeup_stats.c:143:1-3: WARNING: PTR_ERR_OR_ZERO can be used


 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 0b050f7fb8a1 ("PM / wakeup: show wakeup sources stats in sysfs")
CC: Tri Vo <trong@android.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
---

tree:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
head:   14b99dcec44e7bca9f01e042002f57e9f0dda133
commit: 0b050f7fb8a1e45c72ca945bac2821a59d4a0101 [21/23] PM / wakeup: show wakeup sources stats in sysfs

 wakeup_stats.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/drivers/base/power/wakeup_stats.c
+++ b/drivers/base/power/wakeup_stats.c
@@ -140,10 +140,7 @@ EXPORT_SYMBOL_GPL(wakeup_source_sysfs_re
 static int __init wakeup_sources_sysfs_init(void)
 {
 	wakeup_class = class_create(THIS_MODULE, "wakeup");
-	if (IS_ERR(wakeup_class))
-		return PTR_ERR(wakeup_class);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(wakeup_class);
 }
 
 postcore_initcall(wakeup_sources_sysfs_init);

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

* [pm:bleeding-edge 21/23] drivers/base/power/wakeup_stats.c:143:1-3: WARNING: PTR_ERR_OR_ZERO can be used
@ 2019-07-23 14:03 kbuild test robot
  2019-07-23 14:03 ` [PATCH] PM / wakeup: fix ptr_ret.cocci warnings kbuild test robot
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2019-07-23 14:03 UTC (permalink / raw)
  To: Tri Vo
  Cc: kbuild-all, linux-acpi, devel, linux-pm, Rafael J. Wysocki,
	Greg Kroah-Hartman

tree:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
head:   14b99dcec44e7bca9f01e042002f57e9f0dda133
commit: 0b050f7fb8a1e45c72ca945bac2821a59d4a0101 [21/23] PM / wakeup: show wakeup sources stats in sysfs

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>


coccinelle warnings: (new ones prefixed by >>)

>> drivers/base/power/wakeup_stats.c:143:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

* Re: [PATCH] PM / wakeup: fix ptr_ret.cocci warnings
  2019-07-23 14:03 ` [PATCH] PM / wakeup: fix ptr_ret.cocci warnings kbuild test robot
@ 2019-07-23 16:27   ` Tri Vo
  0 siblings, 0 replies; 3+ messages in thread
From: Tri Vo @ 2019-07-23 16:27 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, linux-acpi, devel, Linux PM, Rafael J. Wysocki,
	Greg Kroah-Hartman

On Tue, Jul 23, 2019 at 7:03 AM kbuild test robot <lkp@intel.com> wrote:
>
> From: kbuild test robot <lkp@intel.com>
>
> drivers/base/power/wakeup_stats.c:143:1-3: WARNING: PTR_ERR_OR_ZERO can be used
>
>
>  Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
>
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
>
> Fixes: 0b050f7fb8a1 ("PM / wakeup: show wakeup sources stats in sysfs")
> CC: Tri Vo <trong@android.com>
> Signed-off-by: kbuild test robot <lkp@intel.com>

Reviewed-by: Tri Vo <trong@android.com>

> ---
>
> tree:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
> head:   14b99dcec44e7bca9f01e042002f57e9f0dda133
> commit: 0b050f7fb8a1e45c72ca945bac2821a59d4a0101 [21/23] PM / wakeup: show wakeup sources stats in sysfs
>
>  wakeup_stats.c |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> --- a/drivers/base/power/wakeup_stats.c
> +++ b/drivers/base/power/wakeup_stats.c
> @@ -140,10 +140,7 @@ EXPORT_SYMBOL_GPL(wakeup_source_sysfs_re
>  static int __init wakeup_sources_sysfs_init(void)
>  {
>         wakeup_class = class_create(THIS_MODULE, "wakeup");
> -       if (IS_ERR(wakeup_class))
> -               return PTR_ERR(wakeup_class);
> -
> -       return 0;
> +       return PTR_ERR_OR_ZERO(wakeup_class);
>  }
>
>  postcore_initcall(wakeup_sources_sysfs_init);

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

end of thread, other threads:[~2019-07-23 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23 14:03 [pm:bleeding-edge 21/23] drivers/base/power/wakeup_stats.c:143:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
2019-07-23 14:03 ` [PATCH] PM / wakeup: fix ptr_ret.cocci warnings kbuild test robot
2019-07-23 16:27   ` Tri Vo

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