Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2734198pxb; Mon, 31 Jan 2022 03:11:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwInySkTvLA0nXU7fHE+SVUv/WesywoTBw1w2+vqogIn+TfPUX++3/A3oziqbS20KvTYUOq X-Received: by 2002:a17:902:eac3:: with SMTP id p3mr20265231pld.121.1643627469800; Mon, 31 Jan 2022 03:11:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643627469; cv=none; d=google.com; s=arc-20160816; b=sPNUzmg5JS0xP90Nx6dmZKBSG0UUbQwtmr0a5A5a85K4yaqjVNMxghGC5/GDM3LEsl jq8SjbOWrcu+u/+CzSRa64cd2WGd6OBZtSffwaLdHZCM4K+pp2ttA39J2eBJ0kvM0pt3 uYOsxqydSpGFkWdj0IOWDGhXZEIHhvcjfIvBjstQN++7VC26aeZnVDPbPfOMMy0tp+in 4wYs+iAIT0pZIv9QCPsMXqCt4aSfaL36ItYIibnmlwe31HItV/555tKAHnzc+VXAnLyE n7ZbMzw6Y6cW06HhzCToUkAeBENnVrcD7H3ZJGw1jGPysLnig+5VqKkaWifg2pHA3wjv dtyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EQKtd7jIHOZn7bCRCFKrBTZcC6bt1fxsc6gWDnLBlgM=; b=G2AclVajBIProtbtQAimjXhcaSckEV4K2lWiptB+TDaqYZEGSJebIsO/UXxbJ4+2o/ e3w1lm7qjUbvuAzhsYi8XK73XooybY5dKhT+MF6XdyQLfsu001yN4H9CaABpHWfDwR6B wJEONRT9bf0SiuP71L64AOYf20+D04hQay48eI9CKSOdfwY3GaVplXg72hlTxxoxQKQT HWt6QVEGo+SJhFHfxW3CBB0HsMvNlLlWGiylWnsYwWUt8LWtHjD+z9sCM3Mnx2XyyW8h jFqboJ4ubep4ZBmiwxxlrMTl+prM81ZhjQTCsl4dQOySk9bdwEJ85CUXvjQR01e38SoU oT4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TAf70PRY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id be3si11914549plb.194.2022.01.31.03.10.58; Mon, 31 Jan 2022 03:11:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TAf70PRY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346806AbiA1PDG (ORCPT + 99 others); Fri, 28 Jan 2022 10:03:06 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60716 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245734AbiA1PDF (ORCPT ); Fri, 28 Jan 2022 10:03:05 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 37AD8B825F8 for ; Fri, 28 Jan 2022 15:03:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 428DFC340E6; Fri, 28 Jan 2022 15:03:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643382183; bh=8977n+KmEj7ReKrjHl1AOxf+fEeuIQ9yNfDB243E+VA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TAf70PRYBmouertX+8zGnt2OA3GOBrW9BKCpiTUx/FKHWD8ko5NU1Vh8QZNSaxIwb sB0InlJEntDtGxIJ4eeYMQCU8lro++RobJOjjiEvmxbnmNuQIqxDXYt8gOJ0jscXHw 20aCKTLze0angQC074KZ8UKsg8Bu1tWavkoh0PxIYHT3qP+dLUM4HgchtUw7Jde4uG YKI+rDpnRCEBU8jJXzr+Cuy4RqV/RPLTwPRVyKG8pLNqEo/bxwcTbjvb2NW8asttuE BbXtKU8q3bRr9/sxWMA4m11Da4Ngdxry+oRzte9AU4thAGc1Ht26yOJn0gfjiW137D CHxtGdTxCj+Dg== Date: Fri, 28 Jan 2022 08:02:58 -0700 From: Nathan Chancellor To: Anders Roxell Cc: ndesaulniers@google.com, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, christophe.leroy@csgroup.eu, Arnd Bergmann Subject: Re: [PATCHv3] powerpc: mm: radix_tlb: rearrange the if-else block Message-ID: References: <20220128131713.299198-1-anders.roxell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220128131713.299198-1-anders.roxell@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 28, 2022 at 02:17:13PM +0100, Anders Roxell wrote: > Clang warns: > > arch/powerpc/mm/book3s64/radix_tlb.c:1191:23: error: variable 'hstart' is uninitialized when used here [-Werror,-Wuninitialized] > __tlbiel_va_range(hstart, hend, pid, > ^~~~~~ > arch/powerpc/mm/book3s64/radix_tlb.c:1175:23: note: initialize the variable 'hstart' to silence this warning > unsigned long hstart, hend; > ^ > = 0 > arch/powerpc/mm/book3s64/radix_tlb.c:1191:31: error: variable 'hend' is uninitialized when used here [-Werror,-Wuninitialized] > __tlbiel_va_range(hstart, hend, pid, > ^~~~ > arch/powerpc/mm/book3s64/radix_tlb.c:1175:29: note: initialize the variable 'hend' to silence this warning > unsigned long hstart, hend; > ^ > = 0 > 2 errors generated. > > Rework the 'if (IS_ENABLE(CONFIG_TRANSPARENT_HUGEPAGE))' so hstart/hend > always gets initialized, this will silence the warnings. That will also > simplify the 'else' path. Clang is getting confused with these warnings, > but the warnings is a false-positive. > > Suggested-by: Arnd Bergmann > Suggested-by: Nathan Chancellor > Reviewed-by: Christophe Leroy > Signed-off-by: Anders Roxell Reviewed-by: Nathan Chancellor > --- > arch/powerpc/mm/book3s64/radix_tlb.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) > > diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c > index 7724af19ed7e..5172d5cec2c0 100644 > --- a/arch/powerpc/mm/book3s64/radix_tlb.c > +++ b/arch/powerpc/mm/book3s64/radix_tlb.c > @@ -1171,15 +1171,12 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm, > } > } > } else { > - bool hflush = false; > + bool hflush; > unsigned long hstart, hend; > > - if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) { > - hstart = (start + PMD_SIZE - 1) & PMD_MASK; > - hend = end & PMD_MASK; > - if (hstart < hend) > - hflush = true; > - } > + hstart = (start + PMD_SIZE - 1) & PMD_MASK; > + hend = end & PMD_MASK; > + hflush = IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && hstart < hend; > > if (type == FLUSH_TYPE_LOCAL) { > asm volatile("ptesync": : :"memory"); > -- > 2.34.1 >