Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp926374rwj; Fri, 23 Dec 2022 09:53:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXvQSPVXmH4vRxDobA1ghsJXwyhQHXTMkOJhUSDM0e+Oh2N1np/d3uYjDhkXsVv/vbNLJ9P3 X-Received: by 2002:a62:1b44:0:b0:57f:f7a4:d4c with SMTP id b65-20020a621b44000000b0057ff7a40d4cmr9626895pfb.2.1671818016530; Fri, 23 Dec 2022 09:53:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671818016; cv=none; d=google.com; s=arc-20160816; b=tC2lY+tF4Y7u5I/Hji3A6I/r3ajZMqVQ6VuFihmVhxU2ubAHKfHeyb0w0Fuia5HBOa i3zLT0n+jkHihHKyBpy7kcsiSgap2n4ERHJue8bYqtPNPKMyH+8fOEtCnU/NByMOyjPL eHZmVnnoeVeWDDASfYNnS+42cUuXfydFl2vbCUi3pyGbAbjgI5ROeD3IKuHRkans3XAy +HdmhIX88MpabnsTfSzu12feKwaZExm4Buc3dqNUw2DzBWrj8N1tywp+zcvlcb4g38hZ HpQycjLmEZTtACkc8L6L36zjkqticvNTSZ6RMW4GlMAPhebwjIJoIVVpsPI5blqrFpHw AzvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2uafMcsDy7xY34qNyHJOlM+nv8/0/nNEuvyerHVrghs=; b=WgW3FDcgXaO1+jy5bGWqpeLth5qyi8OewzeGdj7qJ0TlStMGqi8ZuhW8MieSlPtfL4 ykdGfhVNDrhtMa4NTX8mWQTF5KhwGSYYRzQywQttjbwhFt0mhg7ch5bcVJjmb9qVCzZE bCL53vO43gDk8+tfqsWodPRp2XmUGPQhcXqONK8XHNDYLtYt95sj3MUeuRvJMwhsBGwg yjJUixc1Mn6ectrnrWptYYmIpQoc4W0cyQub9mcSzk+siKt2gHpOSuBxU0D9DugO77O3 6ZtlITkIExjuORBOKlAc2Im0DXcApjcWJQVtQ7SqqOrm+EFyIS7ygLpoSbUMs8yrK2CF z2zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LBAf03ZR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a056a000ac500b00576950b449asi4057092pfl.351.2022.12.23.09.53.27; Fri, 23 Dec 2022 09:53:36 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LBAf03ZR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232676AbiLWRbR (ORCPT + 65 others); Fri, 23 Dec 2022 12:31:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231645AbiLWRbO (ORCPT ); Fri, 23 Dec 2022 12:31:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F7232199 for ; Fri, 23 Dec 2022 09:31:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 11AB3B820E4 for ; Fri, 23 Dec 2022 17:31:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BF6AC433D2; Fri, 23 Dec 2022 17:31:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671816670; bh=fgXCLKllqkTCFcfNQk0a1yJ2up7pVcPAhTTWJrO18Uw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LBAf03ZRc2RIIPJwGh4VAPTSrPWKDmgaPJqBGC61Rqig7wTFQ9vu/i5Cuc0wf0LAK DzhilCsBlJ7bDvXUEOK8RE8fp4nlGInRPGcs609jSjNj3rZHm7jzqCU6u9ItG0brrs Dqo+kbLSWglXCvdtnvyV7Hro1y+K4BYMEV/VumSCtAOWYNRKP1l129Fzv5+BfKbBcb b7EwsO7hD6WPjRfc8Cg1lNEaqVrMOivJ7UHzN0yLocC1/7/n2zCnjjg89cqy3wXXkH FaRD1RrRJm4Ft/5X2GfpE/+v+BDrWZMgrJz6YYfi7ZAcDpGgyOAAXo+n88rehcI4Ns 6heHSrgQC/Zmg== Date: Fri, 23 Dec 2022 10:31:08 -0700 From: Nathan Chancellor To: Ammar Faizi Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Linux Kernel Mailing List , Nick Desaulniers , Tom Rix , LLVM Mailing List Subject: Re: [PATCH v1] driver core: Silence 'unused-but-set variable' warning Message-ID: References: <20221223145137.3786601-1-ammar.faizi@intel.com> <7f61b046-c6f2-1dd6-98e9-e5b49b3c7dde@gnuweeb.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7f61b046-c6f2-1dd6-98e9-e5b49b3c7dde@gnuweeb.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Fri, Dec 23, 2022 at 10:31:57PM +0700, Ammar Faizi wrote: > On 12/23/22 10:02 PM, Greg Kroah-Hartman wrote: > > Ick, no, that's horrid and is NOT ok for kernel code, sorry. > > > > Please fix the compiler, this is not a "fix" in any sense of the word > > and is not going to work at all for kernel code. It is possible that the compiler should not emit -Wunused-but-set-variable when the variable is assigned the return value of a function marked with __attribute__((warn_unused_result)) but neither compiler does that today, you'll see the exact same warning from GCC 12.2.0: drivers/base/module.c: In function ‘module_add_driver’: drivers/base/module.c:36:13: error: variable ‘no_warn’ set but not used [-Werror=unused-but-set-variable] 36 | int no_warn; | ^~~~~~~ cc1: all warnings being treated as errors This has come up before too: https://lore.kernel.org/20210726201924.3202278-2-morbo@google.com/ > Agree. > > Sorry for the noise. It turned out I messed up my clang compiler flags. > I forgot to do a "git reset --hard" before recompiling. > > This has nothing todo with the upstream kernel. This warning is in W=1, which are warnings that we want to turn on at some point but the current instances need to be fixed first, so I would say this is still relevant to the upstream kernel. Cheers, Nathan