linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] C64x+ Megamodule PIC: Adjustments for three functions
@ 2017-05-11 13:45 SF Markus Elfring
  2017-05-11 13:46 ` [PATCH 1/4] C6X/megamode-pic: Improve a size determination in init_megamod_pic() SF Markus Elfring
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-05-11 13:45 UTC (permalink / raw)
  To: linux-c6x-dev, Aurelien Jacquiot, Mark Salter; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 11 May 2017 15:20:35 +0200

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

Markus Elfring (4):
  Improve a size determination in init_megamod_pic()
  Delete an error message for a failed memory allocation in init_megamod_pic()
  Delete an unnecessary return statement in megamod_pic_init()
  Fix a typo in a comment line

 arch/c6x/platforms/megamod-pic.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

-- 
2.12.3

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

* [PATCH 1/4] C6X/megamode-pic: Improve a size determination in init_megamod_pic()
  2017-05-11 13:45 [PATCH 0/4] C64x+ Megamodule PIC: Adjustments for three functions SF Markus Elfring
@ 2017-05-11 13:46 ` SF Markus Elfring
  2017-05-11 13:47 ` [PATCH 2/4] C6X/megamode-pic: Delete an error message for a failed memory allocation " SF Markus Elfring
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-05-11 13:46 UTC (permalink / raw)
  To: linux-c6x-dev, Aurelien Jacquiot, Mark Salter; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 11 May 2017 14:56:57 +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/c6x/platforms/megamod-pic.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/c6x/platforms/megamod-pic.c b/arch/c6x/platforms/megamod-pic.c
index 43afc03e4125..72b5f143c105 100644
--- a/arch/c6x/platforms/megamod-pic.c
+++ b/arch/c6x/platforms/megamod-pic.c
@@ -205,6 +205,5 @@ static struct megamod_pic * __init init_megamod_pic(struct device_node *np)
 	int mapping[NR_MUX_OUTPUTS];
 
 	pr_info("Initializing C64x+ Megamodule PIC\n");
-
-	pic = kzalloc(sizeof(struct megamod_pic), GFP_KERNEL);
+	pic = kzalloc(sizeof(*pic), GFP_KERNEL);
 	if (!pic) {
-- 
2.12.3

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

* [PATCH 2/4] C6X/megamode-pic: Delete an error message for a failed memory allocation in init_megamod_pic()
  2017-05-11 13:45 [PATCH 0/4] C64x+ Megamodule PIC: Adjustments for three functions SF Markus Elfring
  2017-05-11 13:46 ` [PATCH 1/4] C6X/megamode-pic: Improve a size determination in init_megamod_pic() SF Markus Elfring
@ 2017-05-11 13:47 ` SF Markus Elfring
  2017-05-11 13:48 ` [PATCH 3/4] C6X/megamode-pic: Delete an unnecessary return statement in megamod_pic_init() SF Markus Elfring
  2017-05-11 13:49 ` [PATCH 4/4] C6X/megamode-pic: Fix a typo in a comment line SF Markus Elfring
  3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-05-11 13:47 UTC (permalink / raw)
  To: linux-c6x-dev, Aurelien Jacquiot, Mark Salter
  Cc: LKML, kernel-janitors, Wolfram Sang

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 11 May 2017 15:00:30 +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/c6x/platforms/megamod-pic.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/c6x/platforms/megamod-pic.c b/arch/c6x/platforms/megamod-pic.c
index 72b5f143c105..cf0ebf25e42f 100644
--- a/arch/c6x/platforms/megamod-pic.c
+++ b/arch/c6x/platforms/megamod-pic.c
@@ -209,7 +209,5 @@ static struct megamod_pic * __init init_megamod_pic(struct device_node *np)
-	if (!pic) {
-		pr_err("%s: Could not alloc PIC structure.\n", np->full_name);
+	if (!pic)
 		return NULL;
-	}
 
 	pic->irqhost = irq_domain_add_linear(np, NR_COMBINERS * 32,
 					     &megamod_domain_ops, pic);
-- 
2.12.3

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

* [PATCH 3/4] C6X/megamode-pic: Delete an unnecessary return statement in megamod_pic_init()
  2017-05-11 13:45 [PATCH 0/4] C64x+ Megamodule PIC: Adjustments for three functions SF Markus Elfring
  2017-05-11 13:46 ` [PATCH 1/4] C6X/megamode-pic: Improve a size determination in init_megamod_pic() SF Markus Elfring
  2017-05-11 13:47 ` [PATCH 2/4] C6X/megamode-pic: Delete an error message for a failed memory allocation " SF Markus Elfring
@ 2017-05-11 13:48 ` SF Markus Elfring
  2017-05-11 13:49 ` [PATCH 4/4] C6X/megamode-pic: Fix a typo in a comment line SF Markus Elfring
  3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-05-11 13:48 UTC (permalink / raw)
  To: linux-c6x-dev, Aurelien Jacquiot, Mark Salter; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 11 May 2017 15:05:41 +0200

The script "checkpatch.pl" pointed information out like the following.

WARNING: void function return statements are not generally useful

Thus remove such a statement in the affected function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/c6x/platforms/megamod-pic.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/c6x/platforms/megamod-pic.c b/arch/c6x/platforms/megamod-pic.c
index cf0ebf25e42f..c49aa63289fa 100644
--- a/arch/c6x/platforms/megamod-pic.c
+++ b/arch/c6x/platforms/megamod-pic.c
@@ -339,6 +339,4 @@ void __init megamod_pic_init(void)
 
 	soc_ops.get_exception = get_exception;
 	soc_ops.assert_event = assert_event;
-
-	return;
 }
-- 
2.12.3

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

* [PATCH 4/4] C6X/megamode-pic: Fix a typo in a comment line
  2017-05-11 13:45 [PATCH 0/4] C64x+ Megamodule PIC: Adjustments for three functions SF Markus Elfring
                   ` (2 preceding siblings ...)
  2017-05-11 13:48 ` [PATCH 3/4] C6X/megamode-pic: Delete an unnecessary return statement in megamod_pic_init() SF Markus Elfring
@ 2017-05-11 13:49 ` SF Markus Elfring
  3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-05-11 13:49 UTC (permalink / raw)
  To: linux-c6x-dev, Aurelien Jacquiot, Mark Salter; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 11 May 2017 15:12:49 +0200

Delete one character from a word in this description for a function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/c6x/platforms/megamod-pic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/c6x/platforms/megamod-pic.c b/arch/c6x/platforms/megamod-pic.c
index c49aa63289fa..d5699ebcc149 100644
--- a/arch/c6x/platforms/megamod-pic.c
+++ b/arch/c6x/platforms/megamod-pic.c
@@ -168,7 +168,7 @@ static void __init set_megamod_mux(struct megamod_pic *pic, int src, int output)
  * The MUX map is an array of up to 12 cells; one for each usable core priority
  * interrupt. The value of a given cell is the megamodule interrupt source
  * which is to me MUXed to the output corresponding to the cell position
- * withing the array. The first cell in the array corresponds to priority
+ * within the array. The first cell in the array corresponds to priority
  * 4 and the last (12th) cell corresponds to priority 15. The allowed
  * values are 4 - ((NR_COMBINERS * 32) - 1). Note that the combined interrupt
  * sources (0 - 3) are not allowed to be mapped through this property. They
-- 
2.12.3

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

end of thread, other threads:[~2017-05-11 13:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-11 13:45 [PATCH 0/4] C64x+ Megamodule PIC: Adjustments for three functions SF Markus Elfring
2017-05-11 13:46 ` [PATCH 1/4] C6X/megamode-pic: Improve a size determination in init_megamod_pic() SF Markus Elfring
2017-05-11 13:47 ` [PATCH 2/4] C6X/megamode-pic: Delete an error message for a failed memory allocation " SF Markus Elfring
2017-05-11 13:48 ` [PATCH 3/4] C6X/megamode-pic: Delete an unnecessary return statement in megamod_pic_init() SF Markus Elfring
2017-05-11 13:49 ` [PATCH 4/4] C6X/megamode-pic: Fix a typo in a comment line SF Markus Elfring

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).