Partial fix, Wconversion will complain anyway due to the return int. Consistently use 'n' for unsigned int iterator.
Signed-off-by: Andrea Bastoni <[email protected]> --- hypervisor/arch/arm64/smmu.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/hypervisor/arch/arm64/smmu.c b/hypervisor/arch/arm64/smmu.c index 41c0ffb4..6a8a46b2 100644 --- a/hypervisor/arch/arm64/smmu.c +++ b/hypervisor/arch/arm64/smmu.c @@ -370,21 +370,22 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) static int arm_smmu_find_sme(u16 id, struct arm_smmu_device *smmu) { struct arm_smmu_smr *smrs = smmu->smrs; - int i, free_idx = -EINVAL; + int free_idx = -EINVAL; + unsigned int n; /* Stream indexing is blissfully easy */ if (!smrs) return id; /* Validating SMRs is... less so */ - for (i = 0; i < smmu->num_mapping_groups; ++i) { - if (!smrs[i].valid) { + for (n = 0; n < smmu->num_mapping_groups; ++n) { + if (!smrs[n].valid) { /* * Note the first free entry we come across, which * we'll claim in the end if nothing else matches. */ if (free_idx < 0) - free_idx = i; + free_idx = n; continue; } /* @@ -394,16 +395,16 @@ static int arm_smmu_find_sme(u16 id, struct arm_smmu_device *smmu) * expect simply identical entries for this case, but there's * no harm in accommodating the generalisation. */ - if ((smmu->arm_sid_mask & smrs[i].mask) == smmu->arm_sid_mask && - !((id ^ smrs[i].id) & ~smrs[i].mask)) { - return i; + if ((smmu->arm_sid_mask & smrs[n].mask) == smmu->arm_sid_mask && + !((id ^ smrs[n].id) & ~smrs[n].mask)) { + return n; } /* * If the new entry has any other overlap with an existing one, * though, then there always exists at least one stream ID * which would cause a conflict, and we can't allow that risk. */ - if (!((id ^ smrs[i].id) & ~(smrs[i].mask | smmu->arm_sid_mask))) + if (!((id ^ smrs[n].id) & ~(smrs[n].mask | smmu->arm_sid_mask))) return -EINVAL; } -- 2.28.0 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/20201028210933.138379-16-andrea.bastoni%40tum.de.
