diff mbox

drivers/x86: fix ptr_ret.cocci warnings

Message ID 20170907100224.GA79024@lkp-wsx02 (mailing list archive)
State Superseded, archived
Delegated to: Darren Hart
Headers show

Commit Message

kernel test robot Sept. 7, 2017, 10:02 a.m. UTC
drivers/platform/x86/thinkpad-wmi.c:1205: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: 3af63e23450d ("drivers/x86: add thinkpad-wmi")
CC: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 thinkpad-wmi.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox

Patch

--- a/drivers/platform/x86/thinkpad-wmi.c
+++ b/drivers/platform/x86/thinkpad-wmi.c
@@ -1202,9 +1202,7 @@  static int __init thinkpad_wmi_init(void
 	platform_device = platform_create_bundle(&platform_driver,
 						 thinkpad_wmi_probe,
 						 NULL, 0, NULL, 0);
-	if (IS_ERR(platform_device))
-		return PTR_ERR(platform_device);
-	return 0;
+	return PTR_ERR_OR_ZERO(platform_device);
 }
 
 static void __exit thinkpad_wmi_exit(void)