Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp742728rwj; Fri, 23 Dec 2022 07:32:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXvYqfUaX3XUYOM7t+ko75rkmFV0febco9MA392nPwdQVnfoSdsyLIu/bbCQ3eaGPDwNbRHD X-Received: by 2002:a17:903:1091:b0:185:441e:222a with SMTP id u17-20020a170903109100b00185441e222amr9377169pld.37.1671809558058; Fri, 23 Dec 2022 07:32:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671809558; cv=none; d=google.com; s=arc-20160816; b=ZfbWr+CtdCM8g+7+PnoRWl3LR3yj2KkAGvtmTJJktUaeEZ/p1oLxyQAyNHldphu113 XUR0ooF2rKLM3WbEFFM4sWDSz59u3Ya/fcbwUGa2IBoTWoORNrHiSpBPzyL4AFFrLdky +PoIyFTEC6L8EBd5LzUrm46rUcuQ+E8/LBkKMevYe7i1to8BIJ/zx2k4hCQEnJ3qdKM6 2U+WGPR7FGeirNz1cgAREOVyCP3R8+hlSLo8+DGIz2ue9f5FGN9v27KIC7Q8UFDwNzAa vlvmSn/lW5EB5wrtO80y8yH1oXw4RTegWcqJngAqV8C88r5oK+Z1SjBGlSFH87LHwBuR 0Nog== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2xIL7u2jtmRB3lMM3win0WLaUMu2iGQJQX1e0nmdIkk=; b=MkpAC5dqQxENIX+JOI0qtILpKZvbM6mBXEMIz5EL/DVhKwK30lzB3mDtmGiQUeYSxW qSlk1RxAclRBFAdq4pDlpfDQfYchWw8r5v1KLTLy3zsdsFi+nDrGp6emJ2wjHNQlo5Kf jmMdqMLcrpYmBdXt9y+oEq3h9wkL22K2O+sDHnoNk52aNHi5ChtURM3048zsMTIE7QZ9 xUThvxegTQr3MCnDhl/eG86t6QwXK2K13nqtc0vus/oHeLk5nLtn8V1fNpWke0NWDiSR U5NJMdfYQK7c/UTtptb1rPfMDDEoK/mwe7wBoZ9/4UU4xr6e+hDdJqLIO0CktOEhtE93 wlCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XccTNox/"; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u3-20020a17090341c300b00178aec118c9si3957595ple.378.2022.12.23.07.32.29; Fri, 23 Dec 2022 07:32:38 -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=@linuxfoundation.org header.s=korg header.b="XccTNox/"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236458AbiLWPCm (ORCPT + 66 others); Fri, 23 Dec 2022 10:02:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236454AbiLWPCd (ORCPT ); Fri, 23 Dec 2022 10:02:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1342523E9E for ; Fri, 23 Dec 2022 07:02:32 -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 BE126B820EB for ; Fri, 23 Dec 2022 15:02:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9B7EC433D2; Fri, 23 Dec 2022 15:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1671807749; bh=zd/QTYB6Krn6kLSVc2hJyljzXGc2//xWd9XTYLs+684=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XccTNox/kpbWY+JJgvIr6vTUP2MsdpeZMHW+ea2M/alCkUGTeC6jxfCU7HoaMSu6z PuPQD4tEOW6zwdkYzUj4zGgRrYawRhzU51OZCLxx9i1tAU/qC9xwclYKEobbfbjvNh AjywA07owkHuwGnlm+rf7AE5lt1O8resKoyS8LA8= Date: Fri, 23 Dec 2022 16:02:26 +0100 From: Greg Kroah-Hartman To: Ammar Faizi Cc: "Rafael J. Wysocki" , Linux Kernel Mailing List , Nathan Chancellor , 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221223145137.3786601-1-ammar.faizi@intel.com> 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 09:51:37PM +0700, Ammar Faizi wrote: > From: Ammar Faizi > > Compiling with clang-16: > > drivers/base/module.c:36:6: error: variable 'no_warn' set but not \ > used [-Werror,-Wunused-but-set-variable] > int no_warn; > ^ > 1 error generated. > > A reason the @no_warn variable exists is: > sysfs_create_link() return value needs not be ignored to silence > another warning. > > So don't remove @no_warn, but add a '(void)no_warn;'. > > Cc: LLVM Mailing List > Signed-off-by: Ammar Faizi > --- > drivers/base/module.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/base/module.c b/drivers/base/module.c > index 46ad4d636731..42f0b3b9e7f8 100644 > --- a/drivers/base/module.c > +++ b/drivers/base/module.c > @@ -59,22 +59,23 @@ void module_add_driver(struct module *mod, struct device_driver *drv) > return; > > /* Don't check return codes; these calls are idempotent */ > no_warn = sysfs_create_link(&drv->p->kobj, &mk->kobj, "module"); > driver_name = make_driver_name(drv); > if (driver_name) { > module_create_drivers_dir(mk); > no_warn = sysfs_create_link(mk->drivers_dir, &drv->p->kobj, > driver_name); > kfree(driver_name); > } > + (void)no_warn; 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. sorry, greg k-h