Message ID | 20190730152012.2615-1-anders.roxell@linaro.org |
---|---|
State | New |
Headers | show |
Series | [v2] iommu: arm-smmu-v3: Mark expected switch fall-through | expand |
On Tue, Jul 30, 2019 at 05:20:11PM +0200, Anders Roxell wrote: > Now that -Wimplicit-fallthrough is passed to GCC by default, the > following warning shows up: > > ../drivers/iommu/arm-smmu-v3.c: In function ‘arm_smmu_write_strtab_ent’: > ../drivers/iommu/arm-smmu-v3.c:1189:7: warning: this statement may fall > through [-Wimplicit-fallthrough=] > if (disable_bypass) > ^ > ../drivers/iommu/arm-smmu-v3.c:1191:3: note: here > default: > ^~~~~~~ > > Rework so that the compiler doesn't warn about fall-through. Make it > clearer by calling 'BUG_ON()' when disable_bypass is set, and always > 'break;' > > Signed-off-by: Anders Roxell <anders.roxell@linaro.org> > --- > drivers/iommu/arm-smmu-v3.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > index a9a9fabd3968..c5c93e48b4db 100644 > --- a/drivers/iommu/arm-smmu-v3.c > +++ b/drivers/iommu/arm-smmu-v3.c > @@ -1186,8 +1186,8 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid, > ste_live = true; > break; > case STRTAB_STE_0_CFG_ABORT: > - if (disable_bypass) > - break; > + BUG_ON(!disable_bypass); > + break; > default: > BUG(); /* STE corruption */ > } > -- > 2.20.1 Acked-by: Will Deacon <will@kernel.org> Joerg -- if you'd like to pick this up as a fix, feel free, otherwise I'll include it in my pull request for 5.4. Cheers, Will
On Tue, Jul 30, 2019 at 04:26:01PM +0100, Will Deacon wrote: > Joerg -- if you'd like to pick this up as a fix, feel free, otherwise I'll > include it in my pull request for 5.4. Applied to iommu/fixes, thanks.
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index a9a9fabd3968..c5c93e48b4db 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -1186,8 +1186,8 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid, ste_live = true; break; case STRTAB_STE_0_CFG_ABORT: - if (disable_bypass) - break; + BUG_ON(!disable_bypass); + break; default: BUG(); /* STE corruption */ }
Now that -Wimplicit-fallthrough is passed to GCC by default, the following warning shows up: ../drivers/iommu/arm-smmu-v3.c: In function ‘arm_smmu_write_strtab_ent’: ../drivers/iommu/arm-smmu-v3.c:1189:7: warning: this statement may fall through [-Wimplicit-fallthrough=] if (disable_bypass) ^ ../drivers/iommu/arm-smmu-v3.c:1191:3: note: here default: ^~~~~~~ Rework so that the compiler doesn't warn about fall-through. Make it clearer by calling 'BUG_ON()' when disable_bypass is set, and always 'break;' Signed-off-by: Anders Roxell <anders.roxell@linaro.org> --- drivers/iommu/arm-smmu-v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.20.1