From patchwork Tue Sep 25 19:44:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 10614749 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 412E5174A for ; Tue, 25 Sep 2018 19:46:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20C2929807 for ; Tue, 25 Sep 2018 19:46:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 114282AB9D; Tue, 25 Sep 2018 19:46:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3E01229807 for ; Tue, 25 Sep 2018 19:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=DKwg0zxdQV8TMYKH0oGG1ugCQ26aC5WPN0vhURRu3Tc=; b=Ddis2EgsRJvZyw 04ALcud5DN79jl2458JsECrDM8HNwP+pihX6mSnjTLf26lecy9w+qcoVGVSzYZV5N8iHcZyCwrjD7 YpTcapNli73zaeJVyJt9MsiokUk5hMgXTJZYXE5XeUJc8cZ6QjcR0gnfhIbl1/bSYhG/vs+ZH2g5Y ke4dG8gkCJ6b76xhS2939TCYwKoOITf/bmkcapIeomIUaObjMk2zMJ0gQaeSJldE5Cs7/wYtDgxVL E9ngxoJ3RcLm/X4buaXephVGXyCdpqyLPUKJS4Ad2pRmlD8kmD4NEo9bvrXA1HBJSq15OwbU2BFdM 3+RaVAj8wT1uB1NkgZKw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4tHZ-0003vD-1c; Tue, 25 Sep 2018 19:46:05 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4tHB-0002s0-At for linux-arm-kernel@lists.infradead.org; Tue, 25 Sep 2018 19:45:42 +0000 Received: by mail-wm1-x341.google.com with SMTP id c14-v6so14674866wmb.4 for ; Tue, 25 Sep 2018 12:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7QrSfGg+m7wwBJbvpF/sopUqMmkgsyHFEUgr8QpLQc0=; b=Fd+k/AmllnYucV2djLKqGkR1Dw+QHlw44mJCWLiGIJApOWlTs7SH9dmM3/GXv7RDWd 5Ne6uQfD7kGSxXs8IAaNOxYC/1z4W4ktminoRUIDg0smXkmP0+66H8bRF2ZpIoZl8hDe 1nB2MRw+aDCnoelCl3B06v2l4IOHZVWhVYrhANdKztVl6ZlonBaEN1ojZ5kqpWLUXQrs JAGFF063rtDBcIQ2P/tLcFSEbYnxQL026K9KWyT7BFNNJ8A/7iAcIJn3WNFVtVaS1mtH aI214esKYRkkdWp2M0BFoZ2Ru4SwM5vF6rfIrBVZ7Yc5TxRWRX0Rta4WXMem+YqAAlq4 6Z/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7QrSfGg+m7wwBJbvpF/sopUqMmkgsyHFEUgr8QpLQc0=; b=nChCaJ3TUdYXM9BgSo1rw+XIHBsiQiTUYwe9HcKBeeJuPAQia4EG8NOEtKg7TIZs2Q w65zrGU3a/c7EiZey7HqrJrJOdeFbj7dSRLnWyHQixaBFNo38TjGLJE7YsWHS8YGSYhh M3Kc9qyQI0Ewzs5myCOJMRAKmB5Dzjye4K+TqWepawZOrbEGf8te6KIE5nRNHKZsH12k Oxpvv4IA3qUcg9mcWpObqFTmGkhQcMfGUzb7dAoaRxxudbHqGAAQGDo2xlFWRoexpHeb hwGitKWBe52NhDooAjrXEzBoV1Pd9y3F7C/Y1OIi3D7VovXECdy3T8O8bDAmN1n3ZTxP PDxg== X-Gm-Message-State: ABuFfohZ485aO9A1/9nhqzQ3bLWEuwtPw9ZSfjyaeyoH39NRQ+d+hIzi 0ZfeauYEpaYeiaKjmkU2Vdg= X-Google-Smtp-Source: ACcGV63F+l1sY/B/LP7P47YHGpnvaNlt3fEuKOYG2DIZsY2Z8M8vRzm4ArDxcuXO79GNP2uSJ6Xu7w== X-Received: by 2002:a1c:706:: with SMTP id 6-v6mr1878009wmh.83.1537904707702; Tue, 25 Sep 2018 12:45:07 -0700 (PDT) Received: from localhost.localdomain ([2a01:4f8:10b:24a5::2]) by smtp.gmail.com with ESMTPSA id k63-v6sm4758089wmd.46.2018.09.25.12.45.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Sep 2018 12:45:07 -0700 (PDT) From: Nathan Chancellor To: Dennis Zhou , Tejun Heo , Christoph Lameter , Catalin Marinas , Will Deacon Subject: [PATCH] arm64: percpu: Initialize ret in the default case Date: Tue, 25 Sep 2018 12:44:59 -0700 Message-Id: <20180925194459.13088-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180925_124541_439003_C8AA8009 X-CRM114-Status: GOOD ( 11.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nathan Chancellor , Prasad Sodagudi , Nick Desaulniers , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Clang warns that if the default case is taken, ret will be uninitialized. ./arch/arm64/include/asm/percpu.h:196:2: warning: variable 'ret' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized] default: ^~~~~~~ ./arch/arm64/include/asm/percpu.h:200:9: note: uninitialized use occurs here return ret; ^~~ ./arch/arm64/include/asm/percpu.h:157:19: note: initialize the variable 'ret' to silence this warning unsigned long ret, loop; ^ = 0 This warning appears several times while building the erofs filesystem. While it's not strictly wrong, the BUILD_BUG will prevent this from becoming a true problem. Initialize ret to 0 in the default case right before the BUILD_BUG to silence all of these warnings. Reported-by: Prasad Sodagudi Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers --- arch/arm64/include/asm/percpu.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h index 9234013e759e..21a81b59a0cc 100644 --- a/arch/arm64/include/asm/percpu.h +++ b/arch/arm64/include/asm/percpu.h @@ -96,6 +96,7 @@ static inline unsigned long __percpu_##op(void *ptr, \ : [val] "Ir" (val)); \ break; \ default: \ + ret = 0; \ BUILD_BUG(); \ } \ \ @@ -125,6 +126,7 @@ static inline unsigned long __percpu_read(void *ptr, int size) ret = READ_ONCE(*(u64 *)ptr); break; default: + ret = 0; BUILD_BUG(); } @@ -194,6 +196,7 @@ static inline unsigned long __percpu_xchg(void *ptr, unsigned long val, : [val] "r" (val)); break; default: + ret = 0; BUILD_BUG(); }