Skip to contentSkip to conversation

drivers/staging/msm/lcdc.c: Convert IS_ERR result to PTR_ERR

PATCH In review Julia Lawall 2 participants 2 messages Jan 27, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 drivers/staging/msm/lcdc.c: Convert IS_ERR result to PTR_ERR

This code elsewhere returns a negative constant to an indicate an error, while IS_ERR returns the result of a >= operation.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x;
@@

if (...) { ...
- return IS_ERR(x);
+ return PTR_ERR(x);
}
// </smpl>

---
 drivers/staging/msm/lcdc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/msm/lcdc.c +2 -2
diff -u -p a/drivers/staging/msm/lcdc.c b/drivers/staging/msm/lcdc.c
@@ -224,12 +224,12 @@ static int __init lcdc_driver_init(void)
 	mdp_lcdc_pclk_clk = clk_get(NULL, "mdp_lcdc_pclk_clk");
 	if (IS_ERR(mdp_lcdc_pclk_clk)) {
 		printk(KERN_ERR "error: can't get mdp_lcdc_pclk_clk!\n");
-		return IS_ERR(mdp_lcdc_pclk_clk);
+		return PTR_ERR(mdp_lcdc_pclk_clk);
 	}
 	mdp_lcdc_pad_pclk_clk = clk_get(NULL, "mdp_lcdc_pad_pclk_clk");
 	if (IS_ERR(mdp_lcdc_pad_pclk_clk)) {
 		printk(KERN_ERR "error: can't get mdp_lcdc_pad_pclk_clk!\n");
-		return IS_ERR(mdp_lcdc_pad_pclk_clk);
+		return PTR_ERR(mdp_lcdc_pad_pclk_clk);
 	}
 //	pm_qos_add_requirement(PM_QOS_SYSTEM_BUS_FREQ , "lcdc",
 //				PM_QOS_DEFAULT_VALUE);
Acked-by on v1 2/2
#1 lore raw
Quoted 7 lines · Julia Lawall

This code elsewhere returns a negative constant to an indicate an error, while IS_ERR returns the result of a >= operation.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.