[PATCH] drivers: rtc: fix ptr_ret.cocci warnings

Viresh Kumar viresh.kumar at linaro.org
Fri Jul 31 02:31:04 PDT 2015


From: kbuild test robot <fengguang.wu at intel.com>

drivers/rtc/rtc-gemini.c:151: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

Signed-off-by: Fengguang Wu <fengguang.wu at intel.com>
Signed-off-by: Viresh Kumar <viresh.kumar at linaro.org>
---
Got a cleanup patch from Fengguang, maybe we can apply this too.

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

--- a/drivers/rtc/rtc-gemini.c
+++ b/drivers/rtc/rtc-gemini.c
@@ -148,10 +148,7 @@ static int gemini_rtc_probe(struct platf
 
 	rtc->rtc_dev = rtc_device_register(pdev->name, dev,
 					   &gemini_rtc_ops, THIS_MODULE);
-	if (IS_ERR(rtc->rtc_dev))
-		return PTR_ERR(rtc->rtc_dev);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(rtc->rtc_dev);
 }
 
 static int gemini_rtc_remove(struct platform_device *pdev)




More information about the linux-arm-kernel mailing list