Skip to contentSkip to conversation

Input: imx_keypad - Propagate the real error code on platform_get_irq() failure

PATCH Applied Fabio Estevam 2 participants 4 messages Feb 15, 2014 – Feb 17, 2014

Subsystems (3)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/2 Input: imx_keypad - Propagate the real error code on platform_get_irq() failure

From: Fabio Estevam <[email protected]>

No need to return a 'fake' return value on platform_get_irq() failure.

Just return the error code itself instead.

---
 drivers/input/keyboard/imx_keypad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/imx_keypad.c +1 -1
index cbf4f80..de07035 100644
@@ -439,7 +439,7 @@ static int imx_keypad_probe(struct platform_device *pdev)
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
 		dev_err(&pdev->dev, "no irq defined in platform data\n");
-		return -EINVAL;
+		return irq;
 	}
 
 	input_dev = devm_input_allocate_device(&pdev->dev);
Signature · 1 line
1.8.1.2
author reviewer
#1 lore raw

PATCH 2/2 Input: imx_keypad - Omit error message devm_kzalloc() failure

From: Fabio Estevam <[email protected]>

There is no need to print an error message in the driver for devm_kzalloc() failure because OOM core code handles it properly.

---
 drivers/input/keyboard/imx_keypad.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/input/keyboard/imx_keypad.c +1 -3
index de07035..40ad98d 100644
@@ -450,10 +450,8 @@ static int imx_keypad_probe(struct platform_device *pdev)
 
 	keypad = devm_kzalloc(&pdev->dev, sizeof(struct imx_keypad),
 			     GFP_KERNEL);
-	if (!keypad) {
-		dev_err(&pdev->dev, "not enough memory for driver data\n");
+	if (!keypad)
 		return -ENOMEM;
-	}
 
 	keypad->input_dev = input_dev;
 	keypad->irq = irq;
Signature · 1 line
1.8.1.2
maintainer
#2 lore raw

Re: [PATCH 2/2] Input: imx_keypad - Omit error message devm_kzalloc() failure

Quoted 4 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

There is no need to print an error message in the driver for devm_kzalloc() failure because OOM core code handles it properly.

I'd rather keep this in. We may change OOM messaging at later time making it less verbose.

Quoted 25 lines
---
 drivers/input/keyboard/imx_keypad.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/input/keyboard/imx_keypad.c +1 -3
index de07035..40ad98d 100644
@@ -450,10 +450,8 @@ static int imx_keypad_probe(struct platform_device *pdev)
 
 	keypad = devm_kzalloc(&pdev->dev, sizeof(struct imx_keypad),
 			     GFP_KERNEL);
-	if (!keypad) {
-		dev_err(&pdev->dev, "not enough memory for driver data\n");
+	if (!keypad)
 		return -ENOMEM;
-	}
 
 	keypad->input_dev = input_dev;
 	keypad->irq = irq;
Signature · 1 line
1.8.1.2
Signature · 1 line
Dmitry
maintainer Applied
#3 lore raw
In reply to Fabio Estevam
Quoted 7 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

No need to return a 'fake' return value on platform_get_irq() failure.

Just return the error code itself instead.

Applied, thank you.

Quoted 20 lines
---
 drivers/input/keyboard/imx_keypad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/imx_keypad.c +1 -1
index cbf4f80..de07035 100644
@@ -439,7 +439,7 @@ static int imx_keypad_probe(struct platform_device *pdev)
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
 		dev_err(&pdev->dev, "no irq defined in platform data\n");
-		return -EINVAL;
+		return irq;
 	}
 
 	input_dev = devm_input_allocate_device(&pdev->dev);
Signature · 1 line
1.8.1.2
Signature · 1 line
Dmitry