From: Wentao Liang <vulab@iscas.ac.cn>
To: "Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Vadim Pasternak" <vadimp@nvidia.com>
Cc: platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, Wentao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH] platform: mellanox: unregister the fan device on probe failure
Date: Tue, 3 Nov 2026 10:55:45 +0000 [thread overview]
Message-ID: <20261103105545.1394576-1-vulab@iscas.ac.cn> (raw)
mlxplat_platdevs_init() registers the mlxreg-fan platform device before
the watchdog and DPU devices, but the error paths for those later
registrations never unregister it: the cleanup chain below
fail_platform_wd_register drops the watchdog, io, LED and hotplug
devices, but not the fan.
Unregister the fan device on those failure paths.
Fixes: 158cd8320776 ("platform: mellanox: Split logic in init and exit flow")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/platform/mellanox/mlx-platform.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/platform/mellanox/mlx-platform.c b/drivers/platform/mellanox/mlx-platform.c
index efcba68d3aa5..303721604c96 100644
--- a/drivers/platform/mellanox/mlx-platform.c
+++ b/drivers/platform/mellanox/mlx-platform.c
@@ -8389,6 +8389,8 @@ static int mlxplat_platdevs_init(struct mlxplat_priv *priv)
fail_platform_wd_register:
while (i--)
platform_device_unregister(priv->pdev_wd[i]);
+ if (mlxplat_fan)
+ platform_device_unregister(priv->pdev_fan);
fail_platform_fan_register:
if (mlxplat_regs_io)
platform_device_unregister(priv->pdev_io_regs);
--
2.34.1
next reply other threads:[~2026-11-03 10:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 10:55 Wentao Liang [this message]
2026-11-03 11:10 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103105545.1394576-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=vadimp@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®