linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ARM-pxa: Adjustments for two function implementations
@ 2017-06-03 20:07 SF Markus Elfring
  2017-06-03 20:08 ` [PATCH 1/3] ARM: pxa: Delete an error message for a failed memory allocation in pxa_pm_init() SF Markus Elfring
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-06-03 20:07 UTC (permalink / raw)
  To: linux-arm-kernel, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Russell King
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] ARM: pxa: Delete an error message for a failed memory allocation in pxa_pm_init()
  2017-06-03 20:07 [PATCH 0/3] ARM-pxa: Adjustments for two function implementations SF Markus Elfring
@ 2017-06-03 20:08 ` SF Markus Elfring
  2017-06-03 20:09 ` [PATCH 2/3] ARM: pxa: Improve a size determination in pxa3xx_u2d_probe() SF Markus Elfring
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-06-03 20:08 UTC (permalink / raw)
  To: linux-arm-kernel, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Russell King
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] ARM: pxa: Improve a size determination in pxa3xx_u2d_probe()
  2017-06-03 20:07 [PATCH 0/3] ARM-pxa: Adjustments for two function implementations SF Markus Elfring
  2017-06-03 20:08 ` [PATCH 1/3] ARM: pxa: Delete an error message for a failed memory allocation in pxa_pm_init() SF Markus Elfring
@ 2017-06-03 20:09 ` SF Markus Elfring
  2017-06-03 20:10 ` [PATCH 3/3] ARM: pxa: Delete an error message for a failed memory allocation " SF Markus Elfring
  2017-06-06 10:53 ` [PATCH 0/3] ARM-pxa: Adjustments for two function implementations Robert Jarzmik
  3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-06-03 20:09 UTC (permalink / raw)
  To: linux-arm-kernel, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Russell King
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] ARM: pxa: Delete an error message for a failed memory allocation in pxa3xx_u2d_probe()
  2017-06-03 20:07 [PATCH 0/3] ARM-pxa: Adjustments for two function implementations SF Markus Elfring
  2017-06-03 20:08 ` [PATCH 1/3] ARM: pxa: Delete an error message for a failed memory allocation in pxa_pm_init() SF Markus Elfring
  2017-06-03 20:09 ` [PATCH 2/3] ARM: pxa: Improve a size determination in pxa3xx_u2d_probe() SF Markus Elfring
@ 2017-06-03 20:10 ` SF Markus Elfring
  2017-06-06 10:53 ` [PATCH 0/3] ARM-pxa: Adjustments for two function implementations Robert Jarzmik
  3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-06-03 20:10 UTC (permalink / raw)
  To: linux-arm-kernel, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Russell King
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] ARM-pxa: Adjustments for two function implementations
  2017-06-03 20:07 [PATCH 0/3] ARM-pxa: Adjustments for two function implementations SF Markus Elfring
                   ` (2 preceding siblings ...)
  2017-06-03 20:10 ` [PATCH 3/3] ARM: pxa: Delete an error message for a failed memory allocation " SF Markus Elfring
@ 2017-06-06 10:53 ` Robert Jarzmik
  3 siblings, 0 replies; 5+ messages in thread
From: Robert Jarzmik @ 2017-06-06 10:53 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-arm-kernel, Daniel Mack, Haojian Zhuang, Russell King,
	LKML, kernel-janitors

SF Markus Elfring <elfring@users.sourceforge.net> writes:

> From: Markus Elfring <elfring@users.sourceforge.net>
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-06-06 10:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-03 20:07 [PATCH 0/3] ARM-pxa: Adjustments for two function implementations SF Markus Elfring
2017-06-03 20:08 ` [PATCH 1/3] ARM: pxa: Delete an error message for a failed memory allocation in pxa_pm_init() SF Markus Elfring
2017-06-03 20:09 ` [PATCH 2/3] ARM: pxa: Improve a size determination in pxa3xx_u2d_probe() SF Markus Elfring
2017-06-03 20:10 ` [PATCH 3/3] ARM: pxa: Delete an error message for a failed memory allocation " SF Markus Elfring
2017-06-06 10:53 ` [PATCH 0/3] ARM-pxa: Adjustments for two function implementations Robert Jarzmik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).