Skip to contentSkip to conversation

Input: imx_keypad - check the return value from clk_prepare_enable()

PATCH New Fabio Estevam 1 participant 2 messages Jul 11, 2013

Subsystems (3)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/2 Input: imx_keypad - check the return value from clk_prepare_enable()

From: Fabio Estevam <[email protected]>

clk_prepare_enable() may fail, so let's check its return value and propagate it in the case of error.

---
 drivers/input/keyboard/imx_keypad.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/input/keyboard/imx_keypad.c +3 -1
index 03c8cc5..99d3360 100644
@@ -512,7 +512,9 @@ static int imx_keypad_probe(struct platform_device *pdev)
 	input_set_drvdata(input_dev, keypad);
 
 	/* Ensure that the keypad will stay dormant until opened */
-	clk_prepare_enable(keypad->clk);
+	error = clk_prepare_enable(keypad->clk);
+	if (error)
+		return error;
 	imx_keypad_inhibit(keypad);
 	clk_disable_unprepare(keypad->clk);
 
Signature · 1 line
1.8.1.2
author reviewer
#1 lore raw

PATCH 2/2 Input: imx_keypad - Simplify devm_kzalloc

From: Fabio Estevam <[email protected]>

According to Documentation/CodingStyle:

"The preferred form for passing a size of a struct is the following:

	p = kmalloc(sizeof(*p), ...);"
---
 drivers/input/keyboard/imx_keypad.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/input/keyboard/imx_keypad.c +1 -2
index 99d3360..c944659 100644
@@ -454,8 +454,7 @@ static int imx_keypad_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	keypad = devm_kzalloc(&pdev->dev, sizeof(struct imx_keypad),
-			     GFP_KERNEL);
+	keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad), GFP_KERNEL);
 	if (!keypad) {
 		dev_err(&pdev->dev, "not enough memory for driver data\n");
 		return -ENOMEM;
Signature · 1 line
1.8.1.2