Skip to content

Commit bd11359

Browse files
miguelafsilva5DavidMCerdeira
authored andcommitted
ref: Add missing default cases to switchs
Switch statements without a default case cause errors with the -Wswitch-default flag. Signed-off-by: Miguel Silva <[email protected]>
1 parent 5fc2678 commit bd11359

File tree

8 files changed

+34
-2
lines changed

8 files changed

+34
-2
lines changed

src/arch/armv8/cache.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ void cache_arch_enumerate(struct cache* dscrp)
4242
case CLIDR_CTYPE_UN:
4343
dscrp->type[i] = UNIFIED;
4444
break;
45+
default:
46+
dscrp->type[i] = UNIFIED;
47+
break;
4548
}
4649
} else {
4750
break;

src/arch/armv8/inc/arch/gicv3.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ static inline void gich_write_lr(size_t i, uint64_t val)
107107
case 15:
108108
sysreg_ich_lr15_el2_write(val);
109109
break;
110+
default:
111+
break;
110112
}
111113
}
112114

src/arch/armv8/psci.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ static void psci_cpumsg_handler(uint32_t event, uint64_t data)
4242
case PSCI_MSG_ON:
4343
psci_wake_from_off();
4444
break;
45+
default:
46+
WARNING("Unknown PSCI IPI event");
47+
break;
4548
}
4649
}
4750

@@ -176,6 +179,9 @@ static int32_t psci_features_handler(uint32_t feature_id)
176179
case PSCI_FEATURES:
177180
ret = PSCI_E_SUCCESS;
178181
break;
182+
default:
183+
ret = PSCI_E_NOT_SUPPORTED;
184+
break;
179185
}
180186

181187
return ret;

src/arch/armv8/vgic.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ static void vgicd_emul_misc_access(struct emul_access* acc, struct vgic_reg_hand
432432
vcpu_writereg(cpu()->vcpu, acc->reg, vgicd->IIDR);
433433
}
434434
break;
435+
default:
436+
vgic_emul_razwi(acc, handlers, gicr_access, vgicr_id);
437+
break;
435438
}
436439
}
437440

@@ -1042,6 +1045,10 @@ void vgic_ipi_handler(uint32_t event, uint64_t data)
10421045
vgic_int_set_field(handlers, cpu()->vcpu, interrupt, (unsigned long)val);
10431046
}
10441047
} break;
1048+
1049+
default:
1050+
WARNING("Unknown VGIC IPI event");
1051+
break;
10451052
}
10461053
}
10471054

src/arch/armv8/vgicv2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static void vgicd_emul_sgiregs_access(struct emul_access* acc,
8181
case 2:
8282
trgtlist = (1U << cpu()->id);
8383
break;
84-
case 3:
84+
default:
8585
return;
8686
}
8787

src/arch/riscv/irqc/aia/vaplic.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ static void vaplic_ipi_handler(uint32_t event, uint64_t data)
277277
case UPDATE_HART_LINE:
278278
vaplic_update_hart(cpu()->vcpu, (size_t)data);
279279
break;
280+
default:
281+
WARNING("Unknown VAPLIC IPI event");
282+
break;
280283
}
281284
}
282285

src/arch/riscv/irqc/plic/vplic.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ static void vplic_ipi_handler(uint32_t event, uint64_t data)
144144
case UPDATE_HART_LINE:
145145
vplic_update_hart_line(cpu()->vcpu, data);
146146
break;
147+
default:
148+
WARNING("Unknown VPLIC IPI event");
149+
break;
147150
}
148151
}
149152

@@ -356,6 +359,11 @@ static bool vplic_hart_emul_handler(struct emul_access* acc)
356359
vcpu_writereg(cpu()->vcpu, acc->reg, vplic_claim(cpu()->vcpu, vcntxt));
357360
}
358361
break;
362+
default:
363+
if (!acc->write) {
364+
vcpu_writereg(cpu()->vcpu, acc->reg, 0);
365+
}
366+
break;
359367
}
360368

361369
return true;

src/core/ipc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ static void ipc_handler(uint32_t event, uint64_t data)
6262
case IPC_NOTIFY:
6363
ipc_notify(ipc_data.shmem_id, ipc_data.event_id);
6464
break;
65+
default:
66+
WARNING("Unknown IPC IPI event");
67+
break;
6568
}
6669
}
6770
CPU_MSG_HANDLER(ipc_handler, IPC_CPUMSG_ID)
@@ -116,7 +119,7 @@ static void ipc_alloc_shmem()
116119
}
117120
}
118121

119-
void ipc_init()
122+
void ipc_init(void)
120123
{
121124
if (cpu_is_master()) {
122125
shmem_table_size = config.shmemlist_size;

0 commit comments

Comments
 (0)