powerpc/mm/hash: Remove unnecessary do { }while(0) loop

Message ID 20180809133642.16007-1-aneesh.kumar@linux.ibm.com
State Accepted
Commit f405b510c93eeb7390d0e2c6ef8d12af9a33021a
Headers show
Series
  • powerpc/mm/hash: Remove unnecessary do { }while(0) loop
Related show

Checks

Context Check Description
snowpatch_ozlabs/build-ppc32 success Test build-ppc32 on branch next
snowpatch_ozlabs/build-ppc64e success Test build-ppc64e on branch next
snowpatch_ozlabs/build-ppc64be success Test build-ppc64be on branch next
snowpatch_ozlabs/build-ppc64le success Test build-ppc64le on branch next
snowpatch_ozlabs/checkpatch fail Test checkpatch on branch next
snowpatch_ozlabs/apply_patch success next/apply_patch Successfully applied

Commit Message

Aneesh Kumar K.V Aug. 9, 2018, 1:36 p.m.
Avoid coverity false warnings like

*** CID 187347:  Control flow issues  (UNREACHABLE)
/arch/powerpc/mm/hash_native_64.c: 819 in native_flush_hash_range()
813        slot += hidx & _PTEIDX_GROUP_IX;
814        hptep = htab_address + slot;
815        want_v = hpte_encode_avpn(vpn, psize, ssize);
816        hpte_v = hpte_get_old_v(hptep);
817
818        if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID))
>>>     CID 187347:  Control flow issues  (UNREACHABLE)

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 arch/powerpc/include/asm/book3s/64/hash-64k.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Michael Ellerman Aug. 13, 2018, 11:23 a.m. | #1
On Thu, 2018-08-09 at 13:36:42 UTC, "Aneesh Kumar K.V" wrote:
> Avoid coverity false warnings like
> 
> *** CID 187347:  Control flow issues  (UNREACHABLE)
> /arch/powerpc/mm/hash_native_64.c: 819 in native_flush_hash_range()
> 813        slot += hidx & _PTEIDX_GROUP_IX;
> 814        hptep = htab_address + slot;
> 815        want_v = hpte_encode_avpn(vpn, psize, ssize);
> 816        hpte_v = hpte_get_old_v(hptep);
> 817
> 818        if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID))
> >>>     CID 187347:  Control flow issues  (UNREACHABLE)
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/f405b510c93eeb7390d0e2c6ef8d12

cheers

Patch

diff --git a/arch/powerpc/include/asm/book3s/64/hash-64k.h b/arch/powerpc/include/asm/book3s/64/hash-64k.h
index c81793d47af9..f82ee8a3b561 100644
--- a/arch/powerpc/include/asm/book3s/64/hash-64k.h
+++ b/arch/powerpc/include/asm/book3s/64/hash-64k.h
@@ -137,10 +137,9 @@  extern bool __rpte_sub_valid(real_pte_t rpte, unsigned long index);
 		shift = mmu_psize_defs[psize].shift;			\
 		for (index = 0; vpn < __end; index++,			\
 			     vpn += (1L << (shift - VPN_SHIFT))) {	\
-			if (!__split || __rpte_sub_valid(rpte, index))	\
-				do {
+		if (!__split || __rpte_sub_valid(rpte, index))
 
-#define pte_iterate_hashed_end() } while(0); } } while(0)
+#define pte_iterate_hashed_end()  } } while(0)
 
 #define pte_pagesize_index(mm, addr, pte)	\
 	(((pte) & H_PAGE_COMBO)? MMU_PAGE_4K: MMU_PAGE_64K)