From nobody Wed Jul 1 04:15:21 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0109DC433EF for ; Fri, 31 Dec 2021 03:39:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242650AbhLaDjm (ORCPT ); Thu, 30 Dec 2021 22:39:42 -0500 Received: from mga05.intel.com ([192.55.52.43]:50282 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242613AbhLaDjk (ORCPT ); Thu, 30 Dec 2021 22:39:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1640921980; x=1672457980; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9zKFqxvpkXMfH8iCX8G0z9vQbSfMlLk2XMC3zy0U5Xc=; b=mOsSqJD9eyFIU4Vyl3SnmMKSFwI4NcPlIU14eJVJ9cNHv8dKluLtdbAu 7NN7NW2oq0SFckiYD+2xRkzJQOe/6kdXtzyONr3xx7n+BbATV6OxKhttA 8zKGytYzo9aNIcHwJ7gA5vWHc4VhBdmoXoa0JjYKQ3ansQt8TT4OILgpX /1jmc5fUSW5/f6I/bwnYyPhGjnv1eyKaDIZD7A93kLWkpDyHFsKimXSyh K5rixt5c8Qg1vASwmRURPdz/+sy3vTOp8OomnI6DT3rFx4k1ca8Iwg5zl MvmkOSVEFWXVaKfAGrhcWjVVOz7b2jmfmX8+t9ebQZSRWjO3GrsfYjjND w==; X-IronPort-AV: E=McAfee;i="6200,9189,10213"; a="328100648" X-IronPort-AV: E=Sophos;i="5.88,250,1635231600"; d="scan'208";a="328100648" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Dec 2021 19:39:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,250,1635231600"; d="scan'208";a="666718311" Received: from allen-box.sh.intel.com ([10.239.159.118]) by fmsmga001.fm.intel.com with ESMTP; 30 Dec 2021 19:39:39 -0800 From: Lu Baolu To: Greg Kroah-Hartman Cc: "Rafael J . Wysocki" , Kay Sievers , linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v2 1/2] driver core: Move driver_sysfs_remove() after driver_sysfs_add() Date: Fri, 31 Dec 2021 11:39:00 +0800 Message-Id: <20211231033901.2168664-2-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211231033901.2168664-1-baolu.lu@linux.intel.com> References: <20211231033901.2168664-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver_sysfs_remove() should be called after driver_sysfs_add() in really_probe(). The out-of-order driver_sysfs_remove() tries to remove some nonexistent nodes under the device and driver sysfs nodes. This is allowed, hence this change doesn't fix any problem, just a cleanup. Signed-off-by: Lu Baolu --- drivers/base/dd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 68ea1f949daa..f6fac016b811 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -577,14 +577,14 @@ static int really_probe(struct device *dev, struct de= vice_driver *drv) if (dev->bus->dma_configure) { ret =3D dev->bus->dma_configure(dev); if (ret) - goto probe_failed; + goto sysfs_failed; } =20 ret =3D driver_sysfs_add(dev); if (ret) { pr_err("%s: driver_sysfs_add(%s) failed\n", __func__, dev_name(dev)); - goto probe_failed; + goto sysfs_failed; } =20 if (dev->pm_domain && dev->pm_domain->activate) { @@ -657,6 +657,8 @@ static int really_probe(struct device *dev, struct devi= ce_driver *drv) else if (drv->remove) drv->remove(dev); probe_failed: + driver_sysfs_remove(dev); +sysfs_failed: if (dev->bus) blocking_notifier_call_chain(&dev->bus->p->bus_notifier, BUS_NOTIFY_DRIVER_NOT_BOUND, dev); @@ -666,7 +668,6 @@ static int really_probe(struct device *dev, struct devi= ce_driver *drv) arch_teardown_dma_ops(dev); kfree(dev->dma_range_map); dev->dma_range_map =3D NULL; - driver_sysfs_remove(dev); dev->driver =3D NULL; dev_set_drvdata(dev, NULL); if (dev->pm_domain && dev->pm_domain->dismiss) --=20 2.25.1 From nobody Wed Jul 1 04:15:21 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA197C4332F for ; Fri, 31 Dec 2021 03:39:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242613AbhLaDjo (ORCPT ); Thu, 30 Dec 2021 22:39:44 -0500 Received: from mga05.intel.com ([192.55.52.43]:50282 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242653AbhLaDjm (ORCPT ); Thu, 30 Dec 2021 22:39:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1640921982; x=1672457982; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+R9IOySMQZos/tW9DfOOxxoxY5gKjgTx54+jATM0/cQ=; b=MiQEGEprVG6t797cu4gRvfRvgL7buDq/54rF1umlY1zuHkWY2GKiPInQ 0LjsSHI488dJyRUXrXJqfeO4jLtgVs+Yi7gk7/X1e1wUjqlmp2mtTpBOj cX3t8cXKmsE+JCFIntTW/yljFnlhvHXR1szAaDOhDcvBpsQ0fkKh2lfTh x4m4pLO3wXGLkwJyFlZi409xyRxPHNKnXN1Vri7m2cVkj6CXMixDQ4xct aB/mJkJYpl90RYIX9XHGZCnZjbK7wRPXFisdfcrufHesmO3N309u4UVwP KRLFKDeRw3mtIMAcuAupDTPodkgchWFwJdm6DQVrAAVM/u3RU0sLWRpJd g==; X-IronPort-AV: E=McAfee;i="6200,9189,10213"; a="328100653" X-IronPort-AV: E=Sophos;i="5.88,250,1635231600"; d="scan'208";a="328100653" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Dec 2021 19:39:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,250,1635231600"; d="scan'208";a="666718318" Received: from allen-box.sh.intel.com ([10.239.159.118]) by fmsmga001.fm.intel.com with ESMTP; 30 Dec 2021 19:39:41 -0800 From: Lu Baolu To: Greg Kroah-Hartman Cc: "Rafael J . Wysocki" , Kay Sievers , linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v2 2/2] driver core: Make bus notifiers in right order in really_probe() Date: Fri, 31 Dec 2021 11:39:01 +0800 Message-Id: <20211231033901.2168664-3-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211231033901.2168664-1-baolu.lu@linux.intel.com> References: <20211231033901.2168664-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If a driver cannot be bound to a device, the correct bus notifier order should be: - BUS_NOTIFY_BIND_DRIVER: driver is about to be bound - BUS_NOTIFY_DRIVER_NOT_BOUND: driver failed to be bound or no notifier if the failure happens before the actual binding. The really_probe() notifies a BUS_NOTIFY_DRIVER_NOT_BOUND event without a BUS_NOTIFY_BIND_DRIVER if .dma_configure() returns failure. This change makes the notifiers in order. Signed-off-by: Lu Baolu --- drivers/base/dd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index f6fac016b811..9eaaff2f556c 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -577,7 +577,7 @@ static int really_probe(struct device *dev, struct devi= ce_driver *drv) if (dev->bus->dma_configure) { ret =3D dev->bus->dma_configure(dev); if (ret) - goto sysfs_failed; + goto pinctrl_bind_failed; } =20 ret =3D driver_sysfs_add(dev); --=20 2.25.1