All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] sh/intc: Adjustments for add_virq_to_pirq()
@ 2017-05-16 18:52 ` SF Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-05-16 18:52 UTC (permalink / raw)
  To: linux-sh, Andrew Morton, Jan Kara, Johannes Weiner, Rich Felker,
	Yoshinori Sato
  Cc: LKML, kernel-janitors

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

-- 
2.13.0


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

* [PATCH 0/2] sh/intc: Adjustments for add_virq_to_pirq()
@ 2017-05-16 18:52 ` SF Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-05-16 18:52 UTC (permalink / raw)
  To: linux-sh, Andrew Morton, Jan Kara, Johannes Weiner, Rich Felker,
	Yoshinori Sato
  Cc: LKML, kernel-janitors

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

-- 
2.13.0

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

* [PATCH 1/2] sh/intc: Improve a size determination in add_virq_to_pirq()
  2017-05-16 18:52 ` SF Markus Elfring
@ 2017-05-16 18:54   ` SF Markus Elfring
  -1 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-05-16 18:54 UTC (permalink / raw)
  To: linux-sh, Andrew Morton, Jan Kara, Johannes Weiner, Rich Felker,
	Yoshinori Sato
  Cc: LKML, kernel-janitors

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

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/sh/intc/virq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
index 35bbe288ddb4..2079425c95ed 100644
--- a/drivers/sh/intc/virq.c
+++ b/drivers/sh/intc/virq.c
@@ -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) {
-- 
2.13.0


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

* [PATCH 1/2] sh/intc: Improve a size determination in add_virq_to_pirq()
@ 2017-05-16 18:54   ` SF Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-05-16 18:54 UTC (permalink / raw)
  To: linux-sh, Andrew Morton, Jan Kara, Johannes Weiner, Rich Felker,
	Yoshinori Sato
  Cc: LKML, kernel-janitors

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

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/sh/intc/virq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
index 35bbe288ddb4..2079425c95ed 100644
--- a/drivers/sh/intc/virq.c
+++ b/drivers/sh/intc/virq.c
@@ -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) {
-- 
2.13.0

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

* [PATCH 2/2] sh/intc: Delete an error message for a failed memory allocation in add_virq_to_pirq()
  2017-05-16 18:52 ` SF Markus Elfring
@ 2017-05-16 18:55   ` SF Markus Elfring
  -1 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-05-16 18:55 UTC (permalink / raw)
  To: linux-sh, Andrew Morton, Jan Kara, Johannes Weiner, Rich Felker,
	Yoshinori Sato
  Cc: LKML, kernel-janitors, Wolfram Sang

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

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/sh/intc/virq.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
index 2079425c95ed..79d733f3411a 100644
--- a/drivers/sh/intc/virq.c
+++ b/drivers/sh/intc/virq.c
@@ -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;
 
-- 
2.13.0


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

* [PATCH 2/2] sh/intc: Delete an error message for a failed memory allocation in add_virq_to_pirq()
@ 2017-05-16 18:55   ` SF Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2017-05-16 18:55 UTC (permalink / raw)
  To: linux-sh, Andrew Morton, Jan Kara, Johannes Weiner, Rich Felker,
	Yoshinori Sato
  Cc: LKML, kernel-janitors, Wolfram Sang

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

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/sh/intc/virq.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
index 2079425c95ed..79d733f3411a 100644
--- a/drivers/sh/intc/virq.c
+++ b/drivers/sh/intc/virq.c
@@ -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;
 
-- 
2.13.0

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

end of thread, other threads:[~2017-05-16 18:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-16 18:52 [PATCH 0/2] sh/intc: Adjustments for add_virq_to_pirq() SF Markus Elfring
2017-05-16 18:52 ` SF Markus Elfring
2017-05-16 18:54 ` [PATCH 1/2] sh/intc: Improve a size determination in add_virq_to_pirq() SF Markus Elfring
2017-05-16 18:54   ` SF Markus Elfring
2017-05-16 18:55 ` [PATCH 2/2] sh/intc: Delete an error message for a failed memory allocation " SF Markus Elfring
2017-05-16 18:55   ` SF Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.