Skip to contentSkip to conversation

C64x+ Megamodule PIC: Adjustments for three functions

PATCH New SF Markus Elfring 1 participant 5 messages May 11, 2017 Kernel janitors

lore
Share & tools
lore
#0 lore raw

cover C64x+ Megamodule PIC: Adjustments for three functions

From: Markus Elfring <[email protected]>
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(-)
Signature · 1 line
2.12.3
#1 lore raw

PATCH 1/4 C6X/megamode-pic: Improve a size determination in init_megamod_pic()

From: Markus Elfring <[email protected]>
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.

---
 arch/c6x/platforms/megamod-pic.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/c6x/platforms/megamod-pic.c +1 -2
index 43afc03e4125..72b5f143c105 100644
@@ -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) {
Signature · 1 line
2.12.3
#2 lore raw

PATCH 2/4 C6X/megamode-pic: Delete an error message for a failed memory allocation in init_megamod_pic()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
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.

---
 arch/c6x/platforms/megamod-pic.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/c6x/platforms/megamod-pic.c +1 -3
index 72b5f143c105..cf0ebf25e42f 100644
@@ -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);
Signature · 1 line
2.12.3
#3 lore raw

PATCH 3/4 C6X/megamode-pic: Delete an unnecessary return statement in megamod_pic_init()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
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.

---
 arch/c6x/platforms/megamod-pic.c | 2 --
 1 file changed, 2 deletions(-)
arch/c6x/platforms/megamod-pic.c +0 -2
index cf0ebf25e42f..c49aa63289fa 100644
@@ -339,6 +339,4 @@ void __init megamod_pic_init(void)
 
 	soc_ops.get_exception = get_exception;
 	soc_ops.assert_event = assert_event;
-
-	return;
 }
Signature · 1 line
2.12.3
#4 lore raw

PATCH 4/4 C6X/megamode-pic: Fix a typo in a comment line

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Thu, 11 May 2017 15:12:49 +0200

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

---
 arch/c6x/platforms/megamod-pic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/c6x/platforms/megamod-pic.c +1 -1
index c49aa63289fa..d5699ebcc149 100644
@@ -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
Signature · 1 line
2.12.3