2017-06-03 20:08:23

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 0/3] ARM-pxa: Adjustments for two function implementations

From: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 22:02:34 +0200

Three update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
Delete an error message for a failed memory allocation in pxa_pm_init()
Improve a size determination in pxa3xx_u2d_probe()
Delete an error message for a failed memory allocation in pxa3xx_u2d_probe()

arch/arm/mach-pxa/pm.c | 4 +---
arch/arm/mach-pxa/pxa3xx-ulpi.c | 6 ++----
2 files changed, 3 insertions(+), 7 deletions(-)

--
2.13.0


2017-06-03 20:09:27

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 1/3] ARM: pxa: Delete an error message for a failed memory allocation in pxa_pm_init()

From: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 21:34:48 +0200

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

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <[email protected]>
---
arch/arm/mach-pxa/pm.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c
index e7450fb49d24..f2237f471750 100644
--- a/arch/arm/mach-pxa/pm.c
+++ b/arch/arm/mach-pxa/pm.c
@@ -110,7 +110,5 @@ static int __init pxa_pm_init(void)
- if (!sleep_save) {
- printk(KERN_ERR "failed to alloc memory for pm save\n");
+ if (!sleep_save)
return -ENOMEM;
- }

suspend_set_ops(&pxa_pm_ops);
return 0;
--
2.13.0

2017-06-03 20:10:17

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 2/3] ARM: pxa: Improve a size determination in pxa3xx_u2d_probe()

From: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 21:43:11 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <[email protected]>
---
arch/arm/mach-pxa/pxa3xx-ulpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/pxa3xx-ulpi.c b/arch/arm/mach-pxa/pxa3xx-ulpi.c
index eba595fac8ca..13f9909ac8bf 100644
--- a/arch/arm/mach-pxa/pxa3xx-ulpi.c
+++ b/arch/arm/mach-pxa/pxa3xx-ulpi.c
@@ -286,5 +286,5 @@ static int pxa3xx_u2d_probe(struct platform_device *pdev)
struct resource *r;
int err;

- u2d = kzalloc(sizeof(struct pxa3xx_u2d_ulpi), GFP_KERNEL);
+ u2d = kzalloc(sizeof(*u2d), GFP_KERNEL);
if (!u2d) {
--
2.13.0

2017-06-03 20:10:37

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 3/3] ARM: pxa: Delete an error message for a failed memory allocation in pxa3xx_u2d_probe()

From: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 21:46:26 +0200

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

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <[email protected]>
---
arch/arm/mach-pxa/pxa3xx-ulpi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm/mach-pxa/pxa3xx-ulpi.c b/arch/arm/mach-pxa/pxa3xx-ulpi.c
index 13f9909ac8bf..60cb59a7ebd1 100644
--- a/arch/arm/mach-pxa/pxa3xx-ulpi.c
+++ b/arch/arm/mach-pxa/pxa3xx-ulpi.c
@@ -290,7 +290,5 @@ static int pxa3xx_u2d_probe(struct platform_device *pdev)
- if (!u2d) {
- dev_err(&pdev->dev, "failed to allocate memory\n");
+ if (!u2d)
return -ENOMEM;
- }

u2d->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(u2d->clk)) {
--
2.13.0

2017-06-06 10:53:31

by Robert Jarzmik

[permalink] [raw]
Subject: Re: [PATCH 0/3] ARM-pxa: Adjustments for two function implementations

SF Markus Elfring <[email protected]> writes:

> From: Markus Elfring <[email protected]>
> Date: Sat, 3 Jun 2017 22:02:34 +0200
>
> Three update suggestions were taken into account
> from static source code analysis.

Applied to the pxa/for-next tree, thanks.

Cheers.

--
Robert