Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4150526pxv; Mon, 26 Jul 2021 23:18:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtn7XLP4rpIg80wwlxokTRN5lozBsP+NODOvxCtkSTcMmrCdcQm5jN1wfBvztwSfWMg24Y X-Received: by 2002:a5d:8d83:: with SMTP id b3mr17879302ioj.179.1627366711674; Mon, 26 Jul 2021 23:18:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627366711; cv=none; d=google.com; s=arc-20160816; b=RL69UqUXCITZvGXdHeg+Sqsnu5rA3B0ZN+XkgE4imFnnd2uD8c22qD0w0g3FwNs+70 hvatnfdwDM6ngdklJvzyj73iWnlUNU29Qxn3qeobalm0U+96KPQ4yhdSEWRmtjPD0dth tNqo4QGw7uJ0aTbZB/07VbqV27WeP0sUd0LkK0vJ9Z9so0QtzAb/3kAqnzKazgq2LD9X 73va+hNFAC+MA248Qc/WnyzejwEv1/eOHY0eJ9os+ELhB9jeoLZzNidTCJNQd4Z5Qrt8 iPL03iXy84YeO5fXdFWWb7Rszamg54rE7knZAA+fxff7Bt45+xlP78iijJnpiY1+X/gf ftzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=tSvAlOWxEIRF8a5C8ywowBQChrZ2YBJxoLkazd7wXek=; b=YYRTE2HSAF3XjltZgRjatmtjyAl+yCtrykvSiVDIu8ilhdA+dJyUMpPw+4IHey9zpX zHre75B5DNCGhL4HdFC2VVfve/abktdHsNly2MoobKxuqUZqsvxn2LJ9DBa/PXSK2N5h WvXkangsvhfCjhnUSyYA7lYq8/HJp75cRc+qVc/XBe/fpfgBgxcPWAqF39NHL0DICp7z GdYqKEeXRLVGQ9InoRzCWW1WG7TTsx2iwkNKxd0saJBAvg6sGMGTXqn4lbtzqcPivBDQ RpsrX5bXlINgTvH5E74erXNLiznjDiSHHw+daR2AQKXnbiOGN3d2LJrrniddKFKfwPVU Pgzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="h/K4jENW"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y7si2166911jae.125.2021.07.26.23.18.20; Mon, 26 Jul 2021 23:18:31 -0700 (PDT) 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=@google.com header.s=20161025 header.b="h/K4jENW"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235368AbhG0GQH (ORCPT + 99 others); Tue, 27 Jul 2021 02:16:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235063AbhG0GQG (ORCPT ); Tue, 27 Jul 2021 02:16:06 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3315EC061757 for ; Mon, 26 Jul 2021 23:16:06 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id x90so7493920ede.8 for ; Mon, 26 Jul 2021 23:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tSvAlOWxEIRF8a5C8ywowBQChrZ2YBJxoLkazd7wXek=; b=h/K4jENWHwQMchT88GLoXiRAkOV4YFgI3pc1+RnvDNIq8SkKcRENVlXM0BLJIkWFir 3nHF7YTlArlshOuhgbbW9oPKG9HdYiqw1qCxBmDa/Can58xbusrbCWy5QcrCi0OfD/sA 9PiXtRAm1877kD9LCrM36joOfraXaNJJ0o30Mtwg0qsgsjv3V0Hts5VcXGH5tJKzMCa1 QGSNLJBGt1IdvQulv0mtcGhKQntIRgN75R4UaPkwnvQKN2xFa4xT//JUI/fP//HxwKuS pY8XnyNhDMKlxDh570s8IoANd9euNLYW9jjndlwRMlCDn9hIROJwhFWYvofGLNBCgDjv cWDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tSvAlOWxEIRF8a5C8ywowBQChrZ2YBJxoLkazd7wXek=; b=q3zHgLA4yG9+LFPeAKN8t6uGcRHA2hzmQT8AK84kzw87OmK0jCHbwogr+MnicyjIdE 9bnfJatx10TUdzjE09vPjMbG45nO5u7L/AUXxdCU0Voedvdt7qNvu8Lw86abfu5aGnOd ahAqTObDWd2P7MaoRG3bm2TaBGmgEhDUf2Ns6fim2dX1hPtBXKM8C5wJGdrRlB8MSXLk wqnQgMbVyWlszGz0sZXBRjkiui8cR5V8SPEDn4F5765mFQaCJyHUqqTyB7lw4F8fb478 CNRE4nb8MnAY2jxpDF4LZ8fZyCQIrqBVRKWjp9YAw6jQzavrLp3sC7ribb/Jq1HARIAl 9kmg== X-Gm-Message-State: AOAM531rVLOuRU6gU20FSqKDf5I6o8yXbgab5CZ5cjAMO3ecW0OGBOLR 0t4oJmW1zY4MwC2gnB3ggDH248oqjcdt6vzyN0nA X-Received: by 2002:a05:6402:27d2:: with SMTP id c18mr25855641ede.261.1627366564124; Mon, 26 Jul 2021 23:16:04 -0700 (PDT) MIME-Version: 1.0 References: <20210714091747.2814370-1-morbo@google.com> <20210726201924.3202278-1-morbo@google.com> <20210726201924.3202278-2-morbo@google.com> In-Reply-To: From: Bill Wendling Date: Mon, 26 Jul 2021 23:15:52 -0700 Message-ID: Subject: Re: [PATCH v2 1/3] base: mark 'no_warn' as unused To: Greg Kroah-Hartman Cc: Nathan Chancellor , "Rafael J. Wysocki" , Nick Desaulniers , clang-built-linux , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 26, 2021 at 10:27 PM Greg Kroah-Hartman wrote: > On Mon, Jul 26, 2021 at 01:47:33PM -0700, Nathan Chancellor wrote: > > + Greg and Rafael as the maintainer and reviewer of drivers/base/module.c > > respectively, drop everyone else. > > Odd no one cc:ed us originally, I guess they didn't want the patch ever > merged? :( > > > > > Original post: > > > > https://lore.kernel.org/r/20210726201924.3202278-2-morbo@google.com/ > > > > On 7/26/2021 1:19 PM, 'Bill Wendling' via Clang Built Linux wrote: > > > Fix the following build warning: > > > > > > drivers/base/module.c:36:6: error: variable 'no_warn' set but not used [-Werror,-Wunused-but-set-variable] > > > int no_warn; > > That's not going to be a good warning to ever have the kernel use due to > how lots of hardware works (i.e. we need to do a read after a write but > we can throw the read away as it does not matter). > > > > > > > > This variable is used to remove another warning, but causes a warning > > > itself. Mark it as 'unused' to avoid that. > > > > > > Signed-off-by: Bill Wendling > > > > Even though they evaluate to the same thing, it might be worth using > > "__always_unused" here because it is :) > > But it is not unused, the value is written into it. > I believe that only matters if the variable is marked "volatile". Otherwise, the variable itself is never used. A "variable that's written to but not read from," in fact, is the whole reason for the warning. > So this isn't ok, sometimes we want to write to variables but never care > about the value, that does not mean the compiler should complain about > it. > Typically, if you don't care about the return value, you simply don't assign it to a variable (cf. printf). However, the functions that assign to "no_warn" have the "warn_unused_result" attribute. The fact that the variable is named "no_warn" seems to indicate that it's meant to remain unused, even if it probably should be checked. Would you rather the warning be turned off on some level? -bw