Skip to contentSkip to conversation

sh/intc: Adjustments for add_virq_to_pirq()

PATCH New SF Markus Elfring 1 participant 3 messages May 16, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover sh/intc: Adjustments for add_virq_to_pirq()

From: Markus Elfring <[email protected]>
Date: Tue, 16 May 2017 20:42:10 +0200

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

Markus Elfring (2):
Improve a size determination
Delete an error message for a failed memory allocation

 drivers/sh/intc/virq.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
Signature · 1 line
2.13.0
#1 lore raw

PATCH 1/2 sh/intc: Improve a size determination in add_virq_to_pirq()

From: Markus Elfring <[email protected]>
Date: Tue, 16 May 2017 19:56:47 +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.

---
 drivers/sh/intc/virq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/sh/intc/virq.c +1 -1
index 35bbe288ddb4..2079425c95ed 100644
@@ -93,5 +93,5 @@ static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
 		last = &entry->next;
 	}
 
-	entry = kzalloc(sizeof(struct intc_virq_list), GFP_ATOMIC);
+	entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
 	if (!entry) {
Signature · 1 line
2.13.0
#2 lore raw

PATCH 2/2 sh/intc: Delete an error message for a failed memory allocation in add_virq_to_pirq()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Tue, 16 May 2017 20:23:43 +0200

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

This issue was detected by using the Coccinelle software.

---
 drivers/sh/intc/virq.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/sh/intc/virq.c +1 -3
index 2079425c95ed..79d733f3411a 100644
@@ -97,7 +97,5 @@ static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
-	if (!entry) {
-		pr_err("can't allocate VIRQ mapping for %d\n", virq);
+	if (!entry)
 		return -ENOMEM;
-	}
 
 	entry->irq = virq;
 
Signature · 1 line
2.13.0