[PATCH] media: exynos4-is: fix ptr_ret.cocci warnings

kernel test robot lkp at intel.com
Sun Jul 19 09:49:07 EDT 2020


From: kernel test robot <lkp at intel.com>

drivers/media/platform/exynos4-is/media-dev.c:1273: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: 18ffec750578 ("media: exynos4-is: Add missed check for pinctrl_lookup_state()")
CC: Chuhong Yuan <hslester96 at gmail.com>
Signed-off-by: kernel test robot <lkp at intel.com>
---

tree:   git://linuxtv.org/media_tree.git master
head:   8f2a4a9d5ff5202d0b3e3a144ebb9b67aabadd29
commit: 18ffec750578f7447c288647d7282c7d12b1d969 [119/306] media: exynos4-is: Add missed check for pinctrl_lookup_state()

 media-dev.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -1270,10 +1270,7 @@ static int fimc_md_get_pinctrl(struct fi
 
 	pctl->state_idle = pinctrl_lookup_state(pctl->pinctrl,
 					PINCTRL_STATE_IDLE);
-	if (IS_ERR(pctl->state_idle))
-		return PTR_ERR(pctl->state_idle);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(pctl->state_idle);
 }
 
 static int cam_clk_prepare(struct clk_hw *hw)



More information about the linux-arm-kernel mailing list