linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: use PTR_ERR_OR_ZERO to fix ptr_ret.cocci warning
@ 2018-07-20  7:32 YueHaibing
  2018-07-24 15:00 ` [tip:x86/cleanups] x86/platform/pcspeaker: Use PTR_ERR_OR_ZERO() " tip-bot for YueHaibing
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2018-07-20  7:32 UTC (permalink / raw)
  To: tglx, mingo, hpa
  Cc: linux-kernel, x86, kstewart, gregkh, pombredanne, YueHaibing

ptr_ret.cocci warnings:
  arch/x86/kernel/pcspeaker.c:12:8-14: WARNING: PTR_ERR_OR_ZERO can be used

use PTR_ERR_OR_ZERO rather than an open-code version to fix this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 arch/x86/kernel/pcspeaker.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/pcspeaker.c b/arch/x86/kernel/pcspeaker.c
index da5190a..4a710ff 100644
--- a/arch/x86/kernel/pcspeaker.c
+++ b/arch/x86/kernel/pcspeaker.c
@@ -9,6 +9,6 @@ static __init int add_pcspkr(void)
 
 	pd = platform_device_register_simple("pcspkr", -1, NULL, 0);
 
-	return IS_ERR(pd) ? PTR_ERR(pd) : 0;
+	return PTR_ERR_OR_ZERO(pd);
 }
 device_initcall(add_pcspkr);
-- 
2.7.0



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

* [tip:x86/cleanups] x86/platform/pcspeaker: Use PTR_ERR_OR_ZERO() to fix ptr_ret.cocci warning
  2018-07-20  7:32 [PATCH] x86: use PTR_ERR_OR_ZERO to fix ptr_ret.cocci warning YueHaibing
@ 2018-07-24 15:00 ` tip-bot for YueHaibing
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for YueHaibing @ 2018-07-24 15:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, yuehaibing, peterz, torvalds, mingo, linux-kernel, tglx

Commit-ID:  2397134ce2d73dcf1d4846579f594c9f3880b2ec
Gitweb:     https://git.kernel.org/tip/2397134ce2d73dcf1d4846579f594c9f3880b2ec
Author:     YueHaibing <yuehaibing@huawei.com>
AuthorDate: Fri, 20 Jul 2018 15:32:13 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 24 Jul 2018 09:46:42 +0200

x86/platform/pcspeaker: Use PTR_ERR_OR_ZERO() to fix ptr_ret.cocci warning

The ptr_ret.cocci script generates the following warning:

  arch/x86/kernel/pcspeaker.c:12:8-14: WARNING: PTR_ERR_OR_ZERO can be used

Use PTR_ERR_OR_ZERO() rather than an open-coded version to fix this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: gregkh@linuxfoundation.org
Cc: kstewart@linuxfoundation.org
Cc: pombredanne@nexb.com
Link: http://lkml.kernel.org/r/20180720073213.14996-1-yuehaibing@huawei.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/pcspeaker.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/pcspeaker.c b/arch/x86/kernel/pcspeaker.c
index da5190a1ea16..4a710ffffd9a 100644
--- a/arch/x86/kernel/pcspeaker.c
+++ b/arch/x86/kernel/pcspeaker.c
@@ -9,6 +9,6 @@ static __init int add_pcspkr(void)
 
 	pd = platform_device_register_simple("pcspkr", -1, NULL, 0);
 
-	return IS_ERR(pd) ? PTR_ERR(pd) : 0;
+	return PTR_ERR_OR_ZERO(pd);
 }
 device_initcall(add_pcspkr);

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

end of thread, other threads:[~2018-07-24 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-20  7:32 [PATCH] x86: use PTR_ERR_OR_ZERO to fix ptr_ret.cocci warning YueHaibing
2018-07-24 15:00 ` [tip:x86/cleanups] x86/platform/pcspeaker: Use PTR_ERR_OR_ZERO() " tip-bot for YueHaibing

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