Skip to contentSkip to conversation

pwm: atmel-tcb: Delete an error message for a failed memory allocation in atmel_tcb_pwm_probe()

PATCH Applied SF Markus Elfring 3 participants 4 messages Dec 15, 2017 – Mar 27, 2018

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

PATCH 1/1 pwm: atmel-tcb: Delete an error message for a failed memory allocation in atmel_tcb_pwm_probe()

From: Markus Elfring <[email protected]>
Date: Fri, 15 Dec 2017 18:55:11 +0100

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 drivers/pwm/pwm-atmel-tcb.c | 1 -
 1 file changed, 1 deletion(-)
drivers/pwm/pwm-atmel-tcb.c +0 -1
index acd3ce8ecf3f..4fb1be246c44 100644
@@ -401,7 +401,6 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
 	tcbpwm = devm_kzalloc(&pdev->dev, sizeof(*tcbpwm), GFP_KERNEL);
 	if (tcbpwm = NULL) {
 		err = -ENOMEM;
-		dev_err(&pdev->dev, "failed to allocate memory\n");
 		goto err_free_tc;
 	}
 
Signature · 1 line
2.15.1
maintainer
#1 lore raw

Hi,

Quoted 6 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Fri, 15 Dec 2017 18:55:11 +0100

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Can you point which coccinelle script highlited this issue?

Quoted 10 lines
---
 drivers/pwm/pwm-atmel-tcb.c | 1 -
 1 file changed, 1 deletion(-)
drivers/pwm/pwm-atmel-tcb.c +0 -0
index acd3ce8ecf3f..4fb1be246c44 100644

drivers/pwm/pwm-atmel-tcb.c static int atmel_tcb_pwm_probe(struct platform_device *pdev) · line 404

Quoted 4 lines
drivers/pwm/pwm-atmel-tcb.c +0 -1
@@ -401,7 +401,6 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
 	tcbpwm = devm_kzalloc(&pdev->dev, sizeof(*tcbpwm), GFP_KERNEL);
 	if (tcbpwm = NULL) {
 		err = -ENOMEM;
-		dev_err(&pdev->dev, "failed to allocate memory\n");

We have this in case of error:

atmel-tcb-pwm pwm: failed to allocate memory
atmel-tcb-pwm: probe of pwm failed with error -12

Which is somehow redundant I admit...

Quoted 4 lines
drivers/pwm/pwm-atmel-tcb.c +0 -0
 		goto err_free_tc;
 	}
 
Signature · 1 line
Nicolas Ferre
#2 lore raw
Quoted 5 lines
Quoted 3 lines

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Can you point which coccinelle script highlited this issue?

Not directly (so far).

I constructed an approach for the semantic patch language based on information from the script “checkpatch.pl”.
Would you like to improve it any ways?

Regards,
Markus