From patchwork Sun Nov 7 09:01:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 12606771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE55CC433F5 for ; Sun, 7 Nov 2021 09:04:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 90BE561039 for ; Sun, 7 Nov 2021 09:04:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 90BE561039 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Mime-Version: Message-Id:Date: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=m+Z0seeLmXOx6TZ2CA128Y3BhZxxVqCFiHNlWFouWdA=; b=KSg 1KYda7Vw9u3zzOaNS9sn8/i349g41imLSF3cbI1VFz1gzew57MK/1flZUvKDG4S5xOTWDEYGRFPRP l6c5H7NRGqRLUN7qc3PGXrZ/WsCfdPiBzU8X/X9qjv77uV3VnHHpYem17L49lD1yWMq9eH9nXNiY2 RCzdPI3QKH/9ybC5i1aFSZx5ayaBIKzpx9IdrOMe1/2hQAQzY1tTxHTNNS8qZkuk3mj6kGsxaCKNA N2BHzWylZTVpyr5uYb4RjJF4x05m/WNZY//9WNFeAO7fdcgDSa6grZf/qmO8wZViVBvI98V04ePzu BxnLAwRmqWfeXVfnX7C+MyE3HA68cOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mje4R-00EAco-65; Sun, 07 Nov 2021 09:02:35 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mje4N-00EAcU-Oo for linux-arm-kernel@lists.infradead.org; Sun, 07 Nov 2021 09:02:33 +0000 Received: by mail-yb1-xb49.google.com with SMTP id r67-20020a252b46000000b005bea12c4befso20456345ybr.19 for ; Sun, 07 Nov 2021 01:02:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=qeeGJyyaKpHgFTabVWWnxTKPKjz0cPTAaB0uJXliMx8=; b=p6/zq8GamrfO5dsN6gFBOdm7y/0ADtzvzyN1U1KOqX23q3Ou0IcYJQpWM3KuoHTsNF 80LXj98XjrovcC9Tt/XY57eT9sAyLHZ2QYICnGg/u9eoeIdtoY8wT0BLdt6UcaDlxuGa cNIoRK0/AmZzFhGdUYH6FuLLCzx4YwPOkUwMXG5EpcqZRJoNmDC++vmlJ2lSV/O2Papy GNGDKG8I3JL/yHMmiEv/iShFAvfucz8AtEFgyMHD5qjatJ9sKY5Md4DEoppvf2RGxkbB kqoi6HLV+JLax4gVeesLCM+dzGYyydchBeaCAHPr/6ZTqymNwyofQHoRt78D3GD3FrKN keJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=qeeGJyyaKpHgFTabVWWnxTKPKjz0cPTAaB0uJXliMx8=; b=DIZxyKG80N9QqXOHfOK7uj68Co8DL3wosKtFJBoRBSagBkVf6TLXoYpW/j200s2aLZ 2ls7GdafQq5hwinXdFi6OfUoN6/lzg81Vt4nBB7jIJV6z1bKldX0tT1MvPqsSnsVCIp3 T69Gs6JTgxQfU/6ufhT0YEfoM5qA7nrR76QAQz5fCaqHKDHG+CFGlgs0f6oBlQw1BM5k ukBTV15+d3OEpQTIcr7QZGHupe+A4zbYzBlYatd8QLfrlormcSgB+5HJ4GQ2TKyEEb1D fpwqm/lq1Ds3+BLnBQV0qk3eGCP1OlVHuIBoCOVzdyP4F+vbUDYihOO9oMz5mWTb2FCQ Vieg== X-Gm-Message-State: AOAM5302wjr6lUOxi8XtJL9KGb/Dkr+J1o7HwbKAASA9gRen1eNtmBwI nMl7IwlOAheVrEwOz2R3QD0i4FfGqng2J8i7RVyWiBu0i4sY6DtTRc+GCcEnzmxQLhtZ5EDyuIf sKfTIxMNG5oF/0DA/kbDX19jTQ0MhjQYa+WtajYAikULe61PzbAT+TF2YDmzWoM8bfsFlSzX7ZW NKfYYD X-Google-Smtp-Source: ABdhPJzl8ECArkBmv7SPiIGrtky2iK7c4nyv/DyDtpG3ZeaKUduZy651Mf5TLUHhW97pn0HzXaTvM4xxMmQ= X-Received: from oupton.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:404]) (user=oupton job=sendgmr) by 2002:a25:a2c1:: with SMTP id c1mr59713037ybn.473.1636275749765; Sun, 07 Nov 2021 01:02:29 -0800 (PST) Date: Sun, 7 Nov 2021 09:01:45 +0000 Message-Id: <20211107090144.3172241-1-oupton@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.34.0.rc0.344.g81b53c2807-goog Subject: [PATCH] clocksource/arm_arch_timer: Fix bogus -Wsometimes-uninitialized warning From: Oliver Upton To: linux-arm-kernel@lists.infradead.org Cc: Mark Rutland , Marc Zyngier , Daniel Lezcano , Nathan Chancellor , Nick Desaulniers , clang-built-linux@googlegroups.com, Oliver Upton , kernel test robot X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211107_010231_853675_6EF3C6CD X-CRM114-Status: GOOD ( 11.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since commit 4775bc63f880 ("clocksource/arm_arch_timer: Add build-time guards for unhandled register accesses"), clang builds emit the following warning: >> drivers/clocksource/arm_arch_timer.c:156:3: warning: variable 'val' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized] default: ^~~~~~~ drivers/clocksource/arm_arch_timer.c:163:9: note: uninitialized use occurs here return val; ^~~ which is of course meaningless, as we break the build if the default case is ever taken in the switch statement. Clang does static analysis before deciding if the branch is ever taken, leading to the warning. Fix the bogus warning by initializing val on the default branch. Reported-by: kernel test robot Fixes: 4775bc63f880 ("clocksource/arm_arch_timer: Add build-time guards for unhandled register accesses") Signed-off-by: Oliver Upton --- Heh, I had caught this earlier but didn't hit send before starting the weekend. Saw the bot email, so sending out. drivers/clocksource/arm_arch_timer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 9a04eacc4412..8e2814fcea11 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -172,6 +172,7 @@ u32 arch_timer_reg_read(int access, enum arch_timer_reg reg, val = readl_relaxed(timer->base + CNTP_CTL); break; default: + val = 0; BUILD_BUG(); } } else if (access == ARCH_TIMER_MEM_VIRT_ACCESS) { @@ -181,6 +182,7 @@ u32 arch_timer_reg_read(int access, enum arch_timer_reg reg, val = readl_relaxed(timer->base + CNTV_CTL); break; default: + val = 0; BUILD_BUG(); } } else {