Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp219267lqj; Wed, 10 Apr 2024 08:32:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVM6vEucUmveZMxkJge9eHwAgZkw5n8Z0eFG8dNPpqON8MjDM5prK9HaSI8d4olKGyRtrcN6ggSx9yxA5EVav4m2s5Mh2HQViDT92TtTw== X-Google-Smtp-Source: AGHT+IEVi4zo9pD6ce6aGyaQ4lHJydm1JANuqYN9IUKRyrRmaTb4yQmjzUJGH6T0YsEwSjcf5NA3 X-Received: by 2002:a50:c2c1:0:b0:568:9936:b2e with SMTP id u1-20020a50c2c1000000b0056899360b2emr1737893edf.24.1712763168334; Wed, 10 Apr 2024 08:32:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712763168; cv=pass; d=google.com; s=arc-20160816; b=MB0b962ZignQ8CcL+G5Y9Y4BbCUxE5QmT1dgpextIk4D9LhS8HhWlOWyn8RYdxZIKy KNHM5/dIcTIVaR2TQSYetxj3ukX+S0yZH28sgi3QDf21Jc6AnRyBztB8ObpPOuRj3V2Y vkEP+NSUS1nP5VXpYIW6EHQvN4s8qrvADhK1/clOUMy8qv/839s5/UyCfY5oseayZi6U 27mafolpbwlT1fn0CZZYmOJG5RUVEZH4NYDiG2f5cMz3LA8Fhn256PJ9WnrjSIwCYJAd J2BeYXFq+34EMlSCc2R3qIQI/UIFBXnxSioLhxDYk+Jj//8xXXghoG845oIu72Re6N6o yv6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:organization:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from:dkim-signature; bh=JiDbFl06YJuAh1RzO/0mnwTAp4ypM/2ggSoDE1oSDQg=; fh=vDI0/erJVk2/EsMfdcwa0u7RYQdOHY406BALvi53r2k=; b=kM3zJ0hM3c6wTzU4uy3BA6R5pbFok2Xhwht4LO4ldKtc60QC/Zk1dfzDUUzHnIOFYU 4dZKlGuZL4lZj2t3lwVe2xQmGK3LEvNuc0y0cDGzq7+juRCH7oUN2ioJ/zS2O1PIdWPl PxaTxlthSQ9lixMwmvjsI/wXbjb0dshOl40pProG1ljSJlXSTIo40kSzJacXC5sMusIF 5gLEKrRCDdcHK4BqWfBcQQTUfuSvCxg4Bi/FFapBgLBPExrX4A6ZkZyZb32dRfYLX2MS FvVzF6BzMFY/fkGwg5BUQT82vAQAJH9lM4tGxr3E6ovus0gK1ujCCqjZ80M2kKvjU10l j0eQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iWCZQnVb; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-138885-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138885-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b97-20020a509f6a000000b0056e2e99b24asi5801218edf.506.2024.04.10.08.32.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 08:32:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138885-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iWCZQnVb; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-138885-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138885-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 093681F21CB6 for ; Wed, 10 Apr 2024 15:32:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4ED9A16E87E; Wed, 10 Apr 2024 15:32:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="iWCZQnVb" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FFA216F0DE; Wed, 10 Apr 2024 15:32:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712763155; cv=none; b=MikozRnuxq0TRnHxnl6L9PBwj9bj/7GLW/PWnk7dSuNPaKEiDAuyR2ilgDmhVntjmxmRP+RppONo1D53zgxbj4/PObNJNdgh+w9qGaJuZ/jFu55O6bDZIMBH9W+Jaj5Wk78jaQyFY5UbatRV10MhZ3yGotJxGxYaYkz6je4NClk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712763155; c=relaxed/simple; bh=dEgjPQZVrrL7vqI7IKViUp1qmoIOfEl5s9dyPS1YBmo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=cLYmwuBBgUHZp4kmjMRVHHswntlSVxzHqeV4/JYWt0qD2kaxfj/K+5jyuJamf3KlxCpGtS5rzF/EoXCOYsPcqv8uWkvKwsgZq7dvUgyrsYUtkvsj5rHxrmhAPNivBMhXsWlPX8GJ9nVLYHpJj/DgD3oqnlI8NNeHIIGVrYzXPWk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=iWCZQnVb; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712763153; x=1744299153; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=dEgjPQZVrrL7vqI7IKViUp1qmoIOfEl5s9dyPS1YBmo=; b=iWCZQnVbXhhwoJgU9P8mSUi0d7N3zO4INJQTJsrwa6qu12P95EaAG7cG 38hhQbvgU4EA848mMPQ2aaDIq8Hi2+6/05nwCxkpnrg2++OjsWeKzA6rF mddIB+QQq1Txy68tVYKKore5ysVS5A8ADBVkKOKPbIUIkqmgNaP82h4gk stQQiU+n/8+ts2sL9AJgy7gQftRQwYZ7lz/wPKmu/5oxICHoZ1daCTF9q 13RsPQkqhkR1XUa1F4Orf9DrlQt0QS3WiSJpaah7EAIU+nkcsOv4Jt2k5 nGgi+4d7cgxIKGYIOcXJ26LYRbRXTTNDOwUBAkkQ/A2T0tO5a1Md7+4D+ g==; X-CSE-ConnectionGUID: q2C80GErSLWIl5FV1BB36Q== X-CSE-MsgGUID: RalOf9Y1Sv6SpUSjJoatFQ== X-IronPort-AV: E=McAfee;i="6600,9927,11039"; a="8260339" X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="8260339" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2024 08:32:32 -0700 X-CSE-ConnectionGUID: m+bpUFx2Q5yIztOqKC/y2g== X-CSE-MsgGUID: eZS9QWdnQA+wEYN3JBJnXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="51568789" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.251.214.234]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2024 08:32:25 -0700 From: Adrian Hunter To: Thomas Gleixner Cc: Naresh Kamboju , Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andy Lutomirski , Vincenzo Frascino , John Stultz , Stephen Boyd , Peter Zijlstra , Randy Dunlap , Bjorn Helgaas , Arnd Bergmann , Anna-Maria Behnsen , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Subject: [PATCH] bug: Fix no-return-statement warning with !CONFIG_BUG Date: Wed, 10 Apr 2024 18:32:12 +0300 Message-Id: <20240410153212.127477-1-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Content-Transfer-Encoding: 8bit BUG() does not return, and arch implementations of BUG() use unreachable() or other non-returning code. However with !CONFIG_BUG, the default implementation is often used instead, and that does not do that. x86 always uses its own implementation, but powerpc with !CONFIG_BUG gives a build error: kernel/time/timekeeping.c: In function ‘timekeeping_debug_get_ns’: kernel/time/timekeeping.c:286:1: error: no return statement in function returning non-void [-Werror=return-type] Add unreachable() to default !CONFIG_BUG BUG() implementation. Fixes: e8e9d21a5df6 ("timekeeping: Refactor timekeeping helpers") Reported-by: Naresh Kamboju Closes: https://lore.kernel.org/all/CA+G9fYvjdZCW=7ZGxS6A_3bysjQ56YF7S-+PNLQ_8a4DKh1Bhg@mail.gmail.com/ Signed-off-by: Adrian Hunter --- include/asm-generic/bug.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 6e794420bd39..b7de3a4eade1 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -156,7 +156,10 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...); #else /* !CONFIG_BUG */ #ifndef HAVE_ARCH_BUG -#define BUG() do {} while (1) +#define BUG() do { \ + do {} while (1); \ + unreachable(); \ +} while (0) #endif #ifndef HAVE_ARCH_BUG_ON -- 2.34.1