Skip to contentSkip to conversation

arm: Remove pointless kmalloc() return value cast in kvm mmu.

PATCH In review Firo Yang 2 participants 2 messages Apr 23, 2015

Subsystems (2)
lore
Share & tools
lore

Firo Yang

author
#0 lore raw

PATCH 14/15 arm: Remove pointless kmalloc() return value cast in kvm mmu.

No need to cast the void pointer returned by kmalloc() in arch/arm/kvm/mmu.c::kvm_alloc_stage2_pgd().

---
 arch/arm/kvm/mmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/kvm/mmu.c +2 -2
index 1d5accb..ce0bce4 100644
@@ -691,8 +691,8 @@ int kvm_alloc_stage2_pgd(struct kvm *kvm)
 		 * work.  This is not used by the hardware and we have no
 		 * alignment requirement for this allocation.
 		 */
-		pgd = (pgd_t *)kmalloc(PTRS_PER_S2_PGD * sizeof(pgd_t),
-				       GFP_KERNEL | __GFP_ZERO);
+		pgd = kmalloc(PTRS_PER_S2_PGD * sizeof(pgd_t),
+				GFP_KERNEL | __GFP_ZERO);
 
 		if (!pgd) {
 			kvm_free_hwpgd(hwpgd);
Signature · 1 line
2.1.0
#1 lore raw
Quoted 2 lines · Firo Yang

No need to cast the void pointer returned by kmalloc() in arch/arm/kvm/mmu.c::kvm_alloc_stage2_pgd().

arm in the subject line seems much too generic for this file. Looking at git log --oneline arch/arm/kvm/mmu.c suggests that ARM: KVM: is popular.

julia

Quoted 25 lines
---
 arch/arm/kvm/mmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/kvm/mmu.c +2 -3
index 1d5accb..ce0bce4 100644
@@ -691,8 +691,8 @@ int kvm_alloc_stage2_pgd(struct kvm *kvm)
 		 * work.  This is not used by the hardware and we have no
 		 * alignment requirement for this allocation.
 		 */
-		pgd = (pgd_t *)kmalloc(PTRS_PER_S2_PGD * sizeof(pgd_t),
-				       GFP_KERNEL | __GFP_ZERO);
+		pgd = kmalloc(PTRS_PER_S2_PGD * sizeof(pgd_t),
+				GFP_KERNEL | __GFP_ZERO);
 
 		if (!pgd) {
 			kvm_free_hwpgd(hwpgd);
--

2.1.0