linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cxl: remove redundant increment of hwirq
@ 2015-02-01 21:40 Colin King
  2015-02-02  1:01 ` Michael Ellerman
  0 siblings, 1 reply; 5+ messages in thread
From: Colin King @ 2015-02-01 21:40 UTC (permalink / raw)
  To: Ian Munsie, Michael Neuling, linuxppc-dev; +Cc: linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Recent commit 80fa93fce37d3490f
("cxl: Name interrupts in /proc/interrupt") introduced a
redundant increment of hwirq which is not used or even
initialised at the point it is incremented. Detected by
cppcheck:

[drivers/misc/cxl/irq.c:439]: (error) Uninitialized
  variable: hwirq

Simple fix, remove the redundant increment.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/misc/cxl/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/cxl/irq.c b/drivers/misc/cxl/irq.c
index c294925..68ab608 100644
--- a/drivers/misc/cxl/irq.c
+++ b/drivers/misc/cxl/irq.c
@@ -436,7 +436,7 @@ int afu_register_irqs(struct cxl_context *ctx, u32 count)
 	 */
 	INIT_LIST_HEAD(&ctx->irq_names);
 	for (r = 1; r < CXL_IRQ_RANGES; r++) {
-		for (i = 0; i < ctx->irqs.range[r]; hwirq++, i++) {
+		for (i = 0; i < ctx->irqs.range[r]; i++) {
 			irq_name = kmalloc(sizeof(struct cxl_irq_name),
 					   GFP_KERNEL);
 			if (!irq_name)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] cxl: remove redundant increment of hwirq
@ 2015-01-08 22:36 Colin King
  2015-01-08 22:42 ` Michael Neuling
  2015-01-09  2:20 ` Ian Munsie
  0 siblings, 2 replies; 5+ messages in thread
From: Colin King @ 2015-01-08 22:36 UTC (permalink / raw)
  To: Ian Munsie, Michael Neuling, linuxppc-dev; +Cc: linux-kernel

From: Colin Ian King <colin.king@canonical.com>

hwirq has not been initialized, however it is being incremented
and also not being referenced in a loop.  This error was detected with
cppcheck:

[drivers/misc/cxl/irq.c:439]: (error) Uninitialized variable: hwirq

Commit 80fa93fce37d ("cxl: Name interrupts in /proc/interrupt") 
introduced this error.

This is a simple fix that removes the redundant increment.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/misc/cxl/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/cxl/irq.c b/drivers/misc/cxl/irq.c
index c294925..68ab608 100644
--- a/drivers/misc/cxl/irq.c
+++ b/drivers/misc/cxl/irq.c
@@ -436,7 +436,7 @@ int afu_register_irqs(struct cxl_context *ctx, u32 count)
 	 */
 	INIT_LIST_HEAD(&ctx->irq_names);
 	for (r = 1; r < CXL_IRQ_RANGES; r++) {
-		for (i = 0; i < ctx->irqs.range[r]; hwirq++, i++) {
+		for (i = 0; i < ctx->irqs.range[r]; i++) {
 			irq_name = kmalloc(sizeof(struct cxl_irq_name),
 					   GFP_KERNEL);
 			if (!irq_name)
-- 
2.1.4

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

end of thread, other threads:[~2015-02-02  1:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-01 21:40 [PATCH] cxl: remove redundant increment of hwirq Colin King
2015-02-02  1:01 ` Michael Ellerman
  -- strict thread matches above, loose matches on Subject: below --
2015-01-08 22:36 Colin King
2015-01-08 22:42 ` Michael Neuling
2015-01-09  2:20 ` Ian Munsie

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