Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4971002rwb; Tue, 17 Jan 2023 07:40:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXsqE9UYEvuPowAl1Gr9QRjEBzUkv3RjhO5bujp/q7PhDSDkGs6rrUWxmcXApAVhy/yLNjJ8 X-Received: by 2002:a05:6a20:3d0f:b0:b8:4812:70cb with SMTP id y15-20020a056a203d0f00b000b8481270cbmr4919084pzi.2.1673970005238; Tue, 17 Jan 2023 07:40:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673970005; cv=none; d=google.com; s=arc-20160816; b=xQuElH9VT4DW/aMMuUqeByY6/qqi1WICLk0RE+RSKk43SI/A/CDS8r09gEQi5b4bfJ LI/4plocPUudXPfso99Q7X/aXduTkGTRdHUrJ6YH3LuAF4o3HxkUWnTG4SIcGtYx5OAX FGyZiwy0BBMqU3nfdmbNFhXc7UzKaN1+xJHwYw64krqzUG1U/CQN+Al2QTOl0uopJONx BB6V3iS8RRIVIs1/AosHeRhyMDVbTRgu3YWOpXkbZ8q3i2IDWntmJ/d8kmkDINDEOnRP QgnLzrEj2DWkRYvTGkIIMXYoooS3f0ywO8g9qwUlphQzmZdja1rS4rZnbNFos+SYQ+6k GJ/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=bZE72bQbCdjzD4uvVhq2NRAlfFol59kn/mO7Ym26I80=; b=ZFVFDJ80WplX0dELkt9hW/v263LQtfLmjsmQHchPCUZhoVUXlUDzcT4uotPFr4FGuL HA/hD2WtSD0f/H9BGBy5tUWyoQ8yFSVe8tmdI2K525lKrFVeKArg5ZYv2zOfDitpu7ar gvEljbCvnZPPhcemVTCdzJhi2PFsQep6geEPa4O6qEjEXvV2NcJ+MzhHT0E/ZB5mE2kj f8BZ1wdahfGQ/3uEj+pFBIFBSmATGYNTj7pv+fA8jAyau7rnCfO3Mzc65ZXBUssTsTl4 kTHjTW/Za1HLZCj1nMZwBXIEu8rNaVo00mNrL+BoQ+p2GYu6cQUGku/VL4TpMCrt81TC 8+lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v2-20020a63f202000000b004ac71b079b6si30945104pgh.349.2023.01.17.07.39.59; Tue, 17 Jan 2023 07:40:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231388AbjAQPQ5 (ORCPT + 48 others); Tue, 17 Jan 2023 10:16:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230359AbjAQPQx (ORCPT ); Tue, 17 Jan 2023 10:16:53 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 64B7139CC1; Tue, 17 Jan 2023 07:16:52 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5C9B11FB; Tue, 17 Jan 2023 07:17:34 -0800 (PST) Received: from eglon.cambridge.arm.com (eglon.cambridge.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 31C783F67D; Tue, 17 Jan 2023 07:16:51 -0800 (PST) From: James Morse To: linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sergei Trofimovich , matoro , =?UTF-8?q?=C3=89meric=20Maschino?= , Andrew Morton , James Morse Subject: [PATCH] ia64: Fix build error due to switch case label appearing next to declaration Date: Tue, 17 Jan 2023 15:16:32 +0000 Message-Id: <20230117151632.393836-1-james.morse@arm.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit aa06a9bd8533 ("ia64: fix clock_getres(CLOCK_MONOTONIC) to report ITC frequency"), gcc 10.1.0 fails to build ia64 with the gnomic: | ../arch/ia64/kernel/sys_ia64.c: In function 'ia64_clock_getres': | ../arch/ia64/kernel/sys_ia64.c:189:3: error: a label can only be part of a statement and a declaration is not a statement | 189 | s64 tick_ns = DIV_ROUND_UP(NSEC_PER_SEC, local_cpu_data->itc_freq); This line appears immediately after a case label in a switch. Move the declarations out of the case, to the top of the function. Fixes: aa06a9bd8533 ("ia64: fix clock_getres(CLOCK_MONOTONIC) to report ITC frequency") Signed-off-by: James Morse --- Found when build testing another series. I've only build tested this. arch/ia64/kernel/sys_ia64.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c index f6a502e8f02c..6e948d015332 100644 --- a/arch/ia64/kernel/sys_ia64.c +++ b/arch/ia64/kernel/sys_ia64.c @@ -170,6 +170,9 @@ ia64_mremap (unsigned long addr, unsigned long old_len, unsigned long new_len, u asmlinkage long ia64_clock_getres(const clockid_t which_clock, struct __kernel_timespec __user *tp) { + struct timespec64 rtn_tp; + s64 tick_ns; + /* * ia64's clock_gettime() syscall is implemented as a vdso call * fsys_clock_gettime(). Currently it handles only @@ -185,8 +188,8 @@ ia64_clock_getres(const clockid_t which_clock, struct __kernel_timespec __user * switch (which_clock) { case CLOCK_REALTIME: case CLOCK_MONOTONIC: - s64 tick_ns = DIV_ROUND_UP(NSEC_PER_SEC, local_cpu_data->itc_freq); - struct timespec64 rtn_tp = ns_to_timespec64(tick_ns); + tick_ns = DIV_ROUND_UP(NSEC_PER_SEC, local_cpu_data->itc_freq); + rtn_tp = ns_to_timespec64(tick_ns); return put_timespec64(&rtn_tp, tp); } -- 2.30.2