iommu: arm-smmu-v3: Mark expected switch fall-through
Subsystems (2)
PATCH 1/1 iommu: arm-smmu-v3: Mark expected switch fall-through
When fall-through warnings was enabled by default, commit d93512ef0f0e ("Makefile: Globally enable fall-through warning"), the following warning was starting to show 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()' when disable_bypass is set, and always 'break;'
--- drivers/iommu/arm-smmu-v3.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iommu/arm-smmu-v3.c +3 -2
@@ -1186,8 +1186,9 @@ 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 ; +if (!disable_bypass) +BUG (); +break ;default :BUG ();/* STE corruption */ }
Signature · 6 lines
2.20.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Robin Murphy
reviewerQuoted 1 line · Anders Roxell
When fall-through warnings was enabled by default, commit
d93512ef0f0e
That commit ID only exists in a handful of old linux-next tags.
Quoted 12 lines
("
Makefile: Globally enable fall-through warning"), the following warning was starting to show 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: ^~~~~~~
Quoted 6 lines
Rework so that the compiler doesn't warn about fall-through. Make it clearer by calling '
BUG()' whendisable_bypassis set, and always 'break;'Cc [email protected] # v4.2+Fixes 5bc0a11664e1 ("iommu/arm-smmu: Don't BUG() if we find aborting STEs with disable_bypass")
Why? There's no actual bug, and not even current kernels have that warning enabled.
Quoted 10 lines
Signed-off-by Anders Roxell <[email protected]>--- drivers/iommu/arm-smmu-v3.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/iommu/arm-smmu-v3.c +0
-0
drivers/iommu/arm-smmu-v3.c static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid, · line 1190
Quoted 7 lines
drivers/iommu/arm-smmu-v3.c +2
-2@@ -1186,8 +1186,9 @@ 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 ; +if (!disable_bypass) +BUG ();
You may as well just use BUG_ON().
Robin.
drivers/iommu/arm-smmu-v3.c static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid, · line 1194
Quoted 5 lines
drivers/iommu/arm-smmu-v3.c +1
-0+break ;default :BUG ();/* STE corruption */ }
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu