lkml.org 
[lkml]   [2018]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] x86: use PTR_ERR_OR_ZERO to fix ptr_ret.cocci warning
Date
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

\
 
 \ /
  Last update: 2018-07-20 09:32    [W:0.044 / U:2.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site