Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp501196lqp; Thu, 4 Apr 2024 23:12:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXmuovhx58UIi9aSd0T1j667Od6efw//b4HS3MvCpXhB3m2kB1S0r0uoEflOQV/CV6D+QfjAangsllUfH31DPnCb2ovnXXJJMqpPyk4XQ== X-Google-Smtp-Source: AGHT+IGIGLC2Oo2xDX/ypnTu9Ann8i5BfBhmKYxmm81GO2XmTX52LUtWJ7i6Jv+PGFedtojvOM6w X-Received: by 2002:a17:90a:c088:b0:2a0:4e60:ba46 with SMTP id o8-20020a17090ac08800b002a04e60ba46mr932910pjs.16.1712297553978; Thu, 04 Apr 2024 23:12:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712297553; cv=pass; d=google.com; s=arc-20160816; b=xI/R8oc8o7MM+gYsfTG9Z85nay1u/0I/fmiepyXtLhL2PV0etphtRxUx79IOuKrq9O LkozJVRWlspv9V2x2dOB3b4oQQpnoP0FnDLQdadOij42trxf/9Tmg9fZW720/p2JLFwl jJIXSTUW+hNkPSUak4gDJAgf4mi305EUbNOk78xiBqKHlQ4iR+d2imGrMERU1AmIAAL6 8pYqg2cQKLhy0fV8ogTVtB03r0Tco/ARVlEr7Oi0ipCy+jSdf3UVtJxCvXfWPERosbdb p/80pM/CUJqueJ0MlJDES2piCOWbIdBtLZDOjWGKK4vg+VST5A5rPyxA/nGx58G5p0iv mLjw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=SIKE16lXu27K6KYgNvL+V9aPBZ+n/pj7F/4iSCgVbVg=; fh=irQseMqmHOPbDi+PL6YKCedbDRU2jr60jLSeZFjl1qk=; b=J71gaAzNV+o3EkozhQjIQ463qz07F2cWJavOr0RrYIednY5DNE5HYC2T8ZbEdu0tAg H1sr/yLk3fI0WFyVt5Ih8pjMWTleDEakOsr/A+l4U+MAIxh6Ds/35uUOkg9k9Lcz3Dzo lCuUjEAmPGH4H/kPIw8aF/EJWUZtsYcAehdQ6BA2mZUCoC8JqQwzkrgCosQjj/kz5OCK 75+ijIq7gpd+U/LKBXHo3sH/5dyHnQ9y/ikg31dq1og1lj288BOP0xjCB2qwNegUG207 aHa5nuF8b3vd6XYSNGdQ2ai5UezNkpI63cqafYRZ68RaLdxTxTqCvs81hMnz9jX6GkEp 7jqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2DxURgT2; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-132454-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132454-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id gz4-20020a17090b0ec400b002a08c864f63si890569pjb.142.2024.04.04.23.12.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 23:12:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132454-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2DxURgT2; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-132454-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132454-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A2CA8280A82 for ; Fri, 5 Apr 2024 06:12:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 927BF55E7C; Fri, 5 Apr 2024 06:09:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="2DxURgT2" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 47978288D7; Fri, 5 Apr 2024 06:09:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712297356; cv=none; b=V/BQXtHjfOgUvhKgDM+ZpZBYndkpCL0jNKB5OkeW4yA19eyXm/QLHYqZOfsSZUpnCpfm4iIezMefkn7BdybdmTbAMJmGZWr1XK8RlDqqvAHkmNJFZmjgLUnssfQ/jLL6na0x+T1qAmRd8BicGKnOccvasATqardg4C3YI4qRVCY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712297356; c=relaxed/simple; bh=Ax4sJ6lM/7okBNB/kwtUl/CrqrB9SAf0EvUEBFTadgA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Bc9RgnpYlJ1XnfPmK5osm2ysBKujQBcEwqTq4sdfQn860v20gBT+xcuNxtIFynvEgP3wYfuUTVtqlv3TkDN+7c+iTAs5uAHHsrn8lLFtuX1rWw/Wrkzf89rd9UCs5xvhxdIbYmGQj4QGsJbB4NIcrA2HiVEzWxAgO5Ui26+2jMc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2DxURgT2; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FED3C43394; Fri, 5 Apr 2024 06:09:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712297356; bh=Ax4sJ6lM/7okBNB/kwtUl/CrqrB9SAf0EvUEBFTadgA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=2DxURgT2rBCom3wbTDMzwKzGgTgPDVe5D2b7G7NxfCNQQ3fCaK6mmf/X+xy9oAt6Q zk+Y0PoCPYdVT8g2/0OfOHrQE8nseBbcmIF8jZrLDcRI/hnOkO6zd+HHMZ74fx9xe+ SrkaI5YuK6qAH1itk0CtCTT4h9U9RcxVzLw73V/4= Date: Fri, 5 Apr 2024 08:09:12 +0200 From: Greg Kroah-Hartman To: Arnd Bergmann Cc: Arnd Bergmann , Luis Chamberlain , linux-modules@vger.kernel.org, "Rafael J. Wysocki" , Jens Axboe , "Ricardo B. Marliere" , Andy Shevchenko , linux-kernel@vger.kernel.org Subject: Re: [PATCH] [v3] module: don't ignore sysfs_create_link() failures Message-ID: <2024040558-animation-express-1ae1@gregkh> References: <20240326145733.3413024-1-arnd@kernel.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240326145733.3413024-1-arnd@kernel.org> On Tue, Mar 26, 2024 at 03:57:18PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > The sysfs_create_link() return code is marked as __must_check, but the > module_add_driver() function tries hard to not care, by assigning the > return code to a variable. When building with 'make W=1', gcc still > warns because this variable is only assigned but not used: > > drivers/base/module.c: In function 'module_add_driver': > drivers/base/module.c:36:6: warning: variable 'no_warn' set but not used [-Wunused-but-set-variable] > > Rework the code to properly unwind and return the error code to the > caller. My reading of the original code was that it tries to > not fail when the links already exist, so keep ignoring -EEXIST > errors. > > Cc: Luis Chamberlain > Cc: linux-modules@vger.kernel.org > Cc: Greg Kroah-Hartman > Cc: "Rafael J. Wysocki" > Fixes: e17e0f51aeea ("Driver core: show drivers in /sys/module/") > See-also: 4a7fb6363f2d ("add __must_check to device management code") > Signed-off-by: Arnd Bergmann > --- > v3: make error handling stricter, add unwinding, > fix build fail with CONFIG_MODULES=n > v2: rework to actually handle the error. I have not tested the > error handling beyond build testing, so please review carefully. > --- > drivers/base/base.h | 9 ++++++--- > drivers/base/bus.c | 9 ++++++++- > drivers/base/module.c | 42 +++++++++++++++++++++++++++++++----------- > 3 files changed, 45 insertions(+), 15 deletions(-) Reviewed-by: Greg Kroah-Hartman