Skip to contentSkip to conversation

genirq: Mark expected switch fall-through

PATCH New Gustavo A. R. Silva 2 participants 2 messages Feb 28, 2019 – Mar 23, 2019 IRQ

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 genirq: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

This patch fixes the following warning:

kernel/irq/manage.c: In function ‘irq_do_set_affinity’:
kernel/irq/manage.c:198:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
cpumask_copy(desc->irq_common_data.affinity, mask); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/irq/manage.c:199:2: note: here
case IRQ_SET_MASK_OK_NOCOPY:
^~~~

In order to get the warning mentioned above, the following line was added to the top Makefile:

KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough=3,)

---
 kernel/irq/manage.c | 1 +
 1 file changed, 1 insertion(+)
kernel/irq/manage.c +1 -0
index 9ec34a2a6638..1401afa0d58a 100644
@@ -196,6 +196,7 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask,
 	case IRQ_SET_MASK_OK:
 	case IRQ_SET_MASK_OK_DONE:
 		cpumask_copy(desc->irq_common_data.affinity, mask);
+		/* fall through */
 	case IRQ_SET_MASK_OK_NOCOPY:
 		irq_validate_effective_affinity(data);
 		irq_set_thread_affinity(desc);
Signature · 1 line
2.21.0
#1 lore raw

[tip:irq/urgent] genirq: Mark expected switch case fall-through

genirq: Mark expected switch case fall-through
Commit-ID:  93417a3fda2060f2a34e3341904024c5b6980d1f
Gitweb:     https://git.kernel.org/tip/93417a3fda2060f2a34e3341904024c5b6980d1f
Author:     Gustavo A. R. Silva <[email protected]>
AuthorDate: Thu, 28 Feb 2019 15:37:14 -0600
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sat, 23 Mar 2019 12:32:01 +0100

genirq: Mark expected switch case fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

With -Wimplicit-fallthrough added to CFLAGS:

kernel/irq/manage.c: In function ‘irq_do_set_affinity’:
kernel/irq/manage.c:198:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
cpumask_copy(desc->irq_common_data.affinity, mask); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/irq/manage.c:199:2: note: here
case IRQ_SET_MASK_OK_NOCOPY:
^~~~

Annotate it.

---
 kernel/irq/manage.c | 1 +
 1 file changed, 1 insertion(+)
kernel/irq/manage.c +1 -0
index 9ec34a2a6638..1401afa0d58a 100644
@@ -196,6 +196,7 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask,
 	case IRQ_SET_MASK_OK:
 	case IRQ_SET_MASK_OK_DONE:
 		cpumask_copy(desc->irq_common_data.affinity, mask);
+		/* fall through */
 	case IRQ_SET_MASK_OK_NOCOPY:
 		irq_validate_effective_affinity(data);
 		irq_set_thread_affinity(desc);