[PATCH] drivers/x86: fix ptr_ret.cocci warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Signed-off-by: Fengguang Wu <fengguang.wu@xxxxxxxxx>
---

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

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



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux