diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2014-01-30 12:38:33 -0500 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2014-03-02 20:15:25 -0500 |
commit | 56041bf920d2937b7cadcb30cb206f0372eee814 (patch) | |
tree | 0e65ada61e9411fdfcc2d693de724e4d863db263 /arch/arm/kvm | |
parent | 8034699a42d68043b495c7e0cfafccd920707ec8 (diff) |
ARM: KVM: fix warning in mmu.c
Compiling with THP enabled leads to the following warning:
arch/arm/kvm/mmu.c: In function ‘unmap_range’:
arch/arm/kvm/mmu.c:177:39: warning: ‘pte’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (kvm_pmd_huge(*pmd) || page_empty(pte)) {
^
Code inspection reveals that these two cases are mutually exclusive,
so GCC is a bit overzealous here. Silence it anyway by initializing
pte to NULL and testing it later on.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'arch/arm/kvm')
-rw-r--r-- | arch/arm/kvm/mmu.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index d7e998c6a08f..80bb1e6c2c29 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c | |||
@@ -144,6 +144,7 @@ static void unmap_range(struct kvm *kvm, pgd_t *pgdp, | |||
144 | while (addr < end) { | 144 | while (addr < end) { |
145 | pgd = pgdp + pgd_index(addr); | 145 | pgd = pgdp + pgd_index(addr); |
146 | pud = pud_offset(pgd, addr); | 146 | pud = pud_offset(pgd, addr); |
147 | pte = NULL; | ||
147 | if (pud_none(*pud)) { | 148 | if (pud_none(*pud)) { |
148 | addr = kvm_pud_addr_end(addr, end); | 149 | addr = kvm_pud_addr_end(addr, end); |
149 | continue; | 150 | continue; |
@@ -174,7 +175,7 @@ static void unmap_range(struct kvm *kvm, pgd_t *pgdp, | |||
174 | /* | 175 | /* |
175 | * If the pmd entry is to be cleared, walk back up the ladder | 176 | * If the pmd entry is to be cleared, walk back up the ladder |
176 | */ | 177 | */ |
177 | if (kvm_pmd_huge(*pmd) || page_empty(pte)) { | 178 | if (kvm_pmd_huge(*pmd) || (pte && page_empty(pte))) { |
178 | clear_pmd_entry(kvm, pmd, addr); | 179 | clear_pmd_entry(kvm, pmd, addr); |
179 | next = kvm_pmd_addr_end(addr, end); | 180 | next = kvm_pmd_addr_end(addr, end); |
180 | if (page_empty(pmd) && !page_empty(pud)) { | 181 | if (page_empty(pmd) && !page_empty(pud)) { |