diff mbox series

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

Message ID 8274c498-1d1b-2ece-365c-98ded714a53c@users.sourceforge.net
State Accepted
Headers show
Series pwm: atmel-tcb: Delete an error message for a failed memory allocation in atmel_tcb_pwm_probe() | expand

Commit Message

SF Markus Elfring Dec. 15, 2017, 6 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/pwm/pwm-atmel-tcb.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Nicolas Ferre Dec. 19, 2017, 2:53 p.m. UTC | #1
Hi,

On 15/12/2017 at 19:00, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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?

> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/pwm/pwm-atmel-tcb.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
> index acd3ce8ecf3f..4fb1be246c44 100644
> --- a/drivers/pwm/pwm-atmel-tcb.c
> +++ b/drivers/pwm/pwm-atmel-tcb.c
> @@ -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...

>  		goto err_free_tc;
>  	}
>  
>
SF Markus Elfring Dec. 19, 2017, 5:12 p.m. UTC | #2
>> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-pwm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thierry Reding March 27, 2018, 9:29 p.m. UTC | #3
On Fri, Dec 15, 2017 at 07:00:46PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/pwm/pwm-atmel-tcb.c | 1 -
>  1 file changed, 1 deletion(-)

Applied, thanks.

Thierry
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
index acd3ce8ecf3f..4fb1be246c44 100644
--- a/drivers/pwm/pwm-atmel-tcb.c
+++ b/drivers/pwm/pwm-atmel-tcb.c
@@ -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;
 	}