sparc32: Fix comparing pointer to 0 coccicheck warning
authorKaixu Xia <kaixuxia@tencent.com>
Mon, 9 Nov 2020 08:06:56 +0000 (16:06 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Feb 2021 00:32:01 +0000 (16:32 -0800)
Fixes coccicheck warning:

/arch/sparc/mm/srmmu.c:354:42-43: WARNING comparing pointer to 0

Avoid pointer type value compared to 0.

Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/mm/srmmu.c

index da4e10b..6ceea57 100644 (file)
@@ -351,7 +351,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm)
        pte_t *ptep;
        struct page *page;
 
-       if ((ptep = pte_alloc_one_kernel(mm)) == 0)
+       if (!(ptep = pte_alloc_one_kernel(mm)))
                return NULL;
        page = pfn_to_page(__nocache_pa((unsigned long)ptep) >> PAGE_SHIFT);
        spin_lock(&mm->page_table_lock);