From nobody Sat Feb 7 23:23:31 2026 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 C2EB9303C83; Fri, 19 Dec 2025 11:00:05 +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=1766142005; cv=none; b=VftC6KvJ9tGexsZ2qd32GM4AwZWLIu8PQlQ9YrgeHTpYY+F1bcZYo3dsN3sn9Af7irUBc+f5pI/W1mPh/8k9qKVj9tlpz1Kas4BM8mdfAVc81gpS4ows7ba5XJJivAq1s1VIWLKpQrA4xuFGOwTam+cDPL7n50+RYwxwP7Jpfmc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766142005; c=relaxed/simple; bh=zXtoaGB9QB5Fkc+DJoOlTNeBL3v1x6M9tWrSIMdLjx8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oXdPua00hzJ1C1sxM290dMOr4EFr83F/X7xdBoelaVgkE/FpZGTZLVohb/uZayyqhHVgMeFCD+oNr0eQz1zsXLeSpUx6vTdAsmJP1apaTWgkCIV8p0jYXjucMu1omIG0Ii1iEk3zYgIpGgz2Xjvpa6KFqzit9bgfUegmSbBsO8U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tc6TXj8K; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tc6TXj8K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C35CC19424; Fri, 19 Dec 2025 11:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766142005; bh=zXtoaGB9QB5Fkc+DJoOlTNeBL3v1x6M9tWrSIMdLjx8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tc6TXj8KRQu1IINknkJJZUKVZlWusnW26+WVU7yZK39cQuLJoWOQS8stevsbfp3AX xTwrokYwRNUkjlcHs030FAiZY3P3xsmGldv05Av6sWDSVxNeRzT0+ktMdBdXAMkHxL 2dVrLIOQRwEhOsOIIF76KWxipWXqOWPinU6I4r/CVnubEXDbCCO20Sm8u7HzeYA1QN qx801Nn3FOvDmOO+zFz+YS2X8SGQHikRbdv9v89ylsuntSMKJozFSqw1XJG7Mqf8Lp I9EqHahSpYTQuyXZAYw2ONjlTAY3JhrSo+JBmZa4xcMR6VC6b6EdA1bGMY1sss7GKs 6JGXFwVtRHH8Q== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vWYDM-0000000065d-0C7a; Fri, 19 Dec 2025 12:00:04 +0100 From: Johan Hovold To: Johan Hovold , Alex Elder , Greg Kroah-Hartman , Vaibhav Hiremath Cc: greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Haotian Zhang Subject: [PATCH 1/3] staging: greybus: arche-platform: fix coldboot probe error path Date: Fri, 19 Dec 2025 11:59:26 +0100 Message-ID: <20251219105928.23329-2-johan@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251219105928.23329-1-johan@kernel.org> References: <20251219105928.23329-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make sure to deregister the PM notifier in case the coldboot sequence fails during probe. Fixes: d29b67d44a7c ("greybus: arche-platform: Add support for init-off fea= ture") Reported-by: Haotian Zhang Link: https://lore.kernel.org/lkml/20251104090825.224-1-vulab@iscas.ac.cn/ Signed-off-by: Johan Hovold --- drivers/staging/greybus/arche-platform.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/gre= ybus/arche-platform.c index d48464390f58..bd069d75391b 100644 --- a/drivers/staging/greybus/arche-platform.c +++ b/drivers/staging/greybus/arche-platform.c @@ -534,8 +534,9 @@ static int arche_platform_probe(struct platform_device = *pdev) mutex_lock(&arche_pdata->platform_state_mutex); ret =3D arche_platform_coldboot_seq(arche_pdata); if (ret) { + mutex_unlock(&arche_pdata->platform_state_mutex); dev_err(dev, "Failed to cold boot svc %d\n", ret); - goto err_coldboot; + goto err_unregister_pm_notifier; } arche_platform_wd_irq_en(arche_pdata); mutex_unlock(&arche_pdata->platform_state_mutex); @@ -544,8 +545,8 @@ static int arche_platform_probe(struct platform_device = *pdev) dev_info(dev, "Device registered successfully\n"); return 0; =20 -err_coldboot: - mutex_unlock(&arche_pdata->platform_state_mutex); +err_unregister_pm_notifier: + unregister_pm_notifier(&arche_pdata->pm_notifier); err_device_remove: device_remove_file(&pdev->dev, &dev_attr_state); return ret; --=20 2.51.2 From nobody Sat Feb 7 23:23:31 2026 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 C2DF5302CBA; Fri, 19 Dec 2025 11:00:05 +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=1766142005; cv=none; b=kvBEol4MgZF9WBX/VJCZiZ/CkE5CutICSA/4cpv6gHALWY2N+8goXyFo0Ofdv9ZxGxlkZxBXY6f3BUZPmIqb/skGZ3y82MNsSzyzitE3i13e8cOBPqDwFaMUVWEOwXqhy+KVRVXNWOL2SlSD+W91qCYdxykkTAD8xWr3OnNE8Og= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766142005; c=relaxed/simple; bh=pF7UD0tW3OiVIYQQAtFEz1D+vMdZQtxYsbSG8ztDW8M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f7LKM4bE5d0+A1PvZyGgVLvBTL3XMDsJ6X8osxgAtsCEdyPtMzNH7ZwGh/1DeSffKchQVhppFhcAS2gW1+Uxv3UuSn4L4O4K1WFKlCVzzqpBY6aueQHntaZxdzgxnAG3bGgW8JB6an9Wb5vmYY8q8Sz7MH1YZfHJOB0JONOunvg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=evEh4JGb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="evEh4JGb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6184FC116B1; Fri, 19 Dec 2025 11:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766142005; bh=pF7UD0tW3OiVIYQQAtFEz1D+vMdZQtxYsbSG8ztDW8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=evEh4JGbpMnbn2aVs+HC8xNCut6OqLhzxd5EtARXde89ocnEPMf3OMmYvMroDcoNb +Hv0lvgzUYPCTGOHTImk4148xwrhMwIUp2iPICxfZdDFV8xh1+oPaoK38cdUwAP4Vi g36fgm0T640tlNHB4UMCVROHe45p3t5TN9eWbNJPl6F9tFl+Rd2h7N2HJ5wO4IAE70 NJE7fYI/ze4nysZknUkwrn5/Ami0I6ADiaTVusX3JAVV0WG+ZLe7WkhHAYOHVRtYWE lJRjENGMXqeFc1+UNU3IBFkSNgqfAy+kChKTWSrf4xlApjQOBeHxh8f56YxP2E+MAn v4eQFtN3zmLvw== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vWYDM-0000000065f-0WMF; Fri, 19 Dec 2025 12:00:04 +0100 From: Johan Hovold To: Johan Hovold , Alex Elder , Greg Kroah-Hartman , Vaibhav Hiremath Cc: greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] staging: greybus: arche-platform: fix memleak on probe failure Date: Fri, 19 Dec 2025 11:59:27 +0100 Message-ID: <20251219105928.23329-3-johan@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251219105928.23329-1-johan@kernel.org> References: <20251219105928.23329-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make sure to depopulate the child devices in case of late probe failures to avoid leaking the corresponding resources. Fixes: fd60ac585607 ("greybus: arche-platform: Fix boot, poweroff and fw_fl= ashing seq with APBs") Signed-off-by: Johan Hovold --- drivers/staging/greybus/arche-platform.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/gre= ybus/arche-platform.c index bd069d75391b..7dcb33a6f2e3 100644 --- a/drivers/staging/greybus/arche-platform.c +++ b/drivers/staging/greybus/arche-platform.c @@ -523,10 +523,9 @@ static int arche_platform_probe(struct platform_device= *pdev) =20 arche_pdata->pm_notifier.notifier_call =3D arche_platform_pm_notifier; ret =3D register_pm_notifier(&arche_pdata->pm_notifier); - if (ret) { dev_err(dev, "failed to register pm notifier %d\n", ret); - goto err_device_remove; + goto err_depopulate; } =20 /* Explicitly power off if requested */ @@ -547,6 +546,8 @@ static int arche_platform_probe(struct platform_device = *pdev) =20 err_unregister_pm_notifier: unregister_pm_notifier(&arche_pdata->pm_notifier); +err_depopulate: + of_platform_depopulate(dev); err_device_remove: device_remove_file(&pdev->dev, &dev_attr_state); return ret; --=20 2.51.2 From nobody Sat Feb 7 23:23:31 2026 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 EEB3214A62B; Fri, 19 Dec 2025 11:00:05 +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=1766142006; cv=none; b=gzK9ekN55OYo/0tubhWR+HVVPvA0UHhwhljMGDfSGOU5HuYvmiOwUGLAIkxJZWZ5lCto+CfODGEPkVC26qHJlmDrIOQSlvTeSe+TCDi19joVZKtUfwtL+TKjPPdM9DBvNgRLva7nm4lqshW/9yVToMWXX8SWt4uzVWHI4Wji/Nc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766142006; c=relaxed/simple; bh=rF1yPDuyGMfo+9a72fmkdnuoNV1bBA7A6RwbKHhS2Ss=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AEpbcUYyD0RjBPEw0G5lF7r3UlScSL3N6dWpUuBrHmrB6rL7iADObqC5DdobEoBSjQaGP3aCKavvobkx/QrXm6Io38v30kUmSKbTfMPOS50x5TQA8vgbGE/x59poZfpVcIgoVWbqhX4jTllMhXmr7yS2ZlxWw0Udygq9tSjKEwE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mWOYjAWW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mWOYjAWW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C082C116C6; Fri, 19 Dec 2025 11:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766142005; bh=rF1yPDuyGMfo+9a72fmkdnuoNV1bBA7A6RwbKHhS2Ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mWOYjAWWw07MCGCIFhNQyL1gDA/wi0yNnrbIUPLw0ly8jEULMs3/rFjWEatQzKqgd 2GhSx+0+lioW708eKxQa0zj94uFLfjauZcTE6sPcagrbmP/WO93KO6lNclQlbnRFQy rQGcRo2PjRNzOSp/Ad3MxYG83MOU9FYykVQEKT/gkAtUrL0rbBeRne2Ka43k4slSSA rI6CdHmxArPv7KfEgntnL9GOp6PwdnW/6NFkzoBG/GoFJjGzY5YEKCNbFK2yq74KM5 s6pY5nr8ZRmyFxibLkSsdmcEZexAaFoC0+uoySPS8t2WbTS1S9uB69VsxaL0cz2uro 6IbvaqO38ZMzA== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vWYDM-0000000065i-0wjA; Fri, 19 Dec 2025 12:00:04 +0100 From: Johan Hovold To: Johan Hovold , Alex Elder , Greg Kroah-Hartman , Vaibhav Hiremath Cc: greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] staging: greybus: arche-platform: fix OF populate on driver rebind Date: Fri, 19 Dec 2025 11:59:28 +0100 Message-ID: <20251219105928.23329-4-johan@kernel.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251219105928.23329-1-johan@kernel.org> References: <20251219105928.23329-1-johan@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since commit c6e126de43e7 ("of: Keep track of populated platform devices") child devices will not be created by of_platform_populate() if the devices had previously been deregistered individually so that the OF_POPULATED flag is still set in the corresponding OF nodes. Switch to using of_platform_depopulate() instead of open coding so that the child devices are created if the driver is rebound. Fixes: bc142bbb4ceb ("greybus: arche_platform: Remove child's platform devi= ce as part of _remove() fn") Signed-off-by: Johan Hovold --- drivers/staging/greybus/arche-platform.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/gre= ybus/arche-platform.c index 7dcb33a6f2e3..8aaff4e45660 100644 --- a/drivers/staging/greybus/arche-platform.c +++ b/drivers/staging/greybus/arche-platform.c @@ -553,22 +553,13 @@ static int arche_platform_probe(struct platform_devic= e *pdev) return ret; } =20 -static int arche_remove_child(struct device *dev, void *unused) -{ - struct platform_device *pdev =3D to_platform_device(dev); - - platform_device_unregister(pdev); - - return 0; -} - static void arche_platform_remove(struct platform_device *pdev) { struct arche_platform_drvdata *arche_pdata =3D platform_get_drvdata(pdev); =20 unregister_pm_notifier(&arche_pdata->pm_notifier); device_remove_file(&pdev->dev, &dev_attr_state); - device_for_each_child(&pdev->dev, NULL, arche_remove_child); + of_platform_depopulate(&pdev->dev); arche_platform_poweroff_seq(arche_pdata); =20 if (usb3613_hub_mode_ctrl(false)) --=20 2.51.2