From: Dan Carpenter <dan.carpenter@linaro.org>
To: Binbin Zhou <zhoubinbin@loongson.cn>
Cc: Chong Qiao <qiaochong@loongson.cn>, Lee Jones <lee@kernel.org>,
Corey Minyard <corey@minyard.net>,
Huacai Chen <chenhuacai@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] mfd: ls2kbmc: check for devm_mfd_add_devices() failure
Date: Fri, 3 Oct 2025 12:29:18 +0300 [thread overview]
Message-ID: <e3e7cf2cfded48c9fca8bc981c54bbcb7edb9580.1759478975.git.dan.carpenter@linaro.org> (raw)
In-Reply-To: <cover.1759478975.git.dan.carpenter@linaro.org>
Call pci_disable_device() if devm_mfd_add_devices() fails.
Fixes: 0d64f6d1ffe9 ("mfd: ls2kbmc: Introduce Loongson-2K BMC core driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/mfd/ls2k-bmc-core.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/mfd/ls2k-bmc-core.c b/drivers/mfd/ls2k-bmc-core.c
index 5f38514fa89e..69387dad6661 100644
--- a/drivers/mfd/ls2k-bmc-core.c
+++ b/drivers/mfd/ls2k-bmc-core.c
@@ -495,9 +495,13 @@ static int ls2k_bmc_probe(struct pci_dev *dev, const struct pci_device_id *id)
goto disable_pci;
}
- return devm_mfd_add_devices(&dev->dev, PLATFORM_DEVID_AUTO,
- ls2k_bmc_cells, ARRAY_SIZE(ls2k_bmc_cells),
- &dev->resource[0], 0, NULL);
+ ret = devm_mfd_add_devices(&dev->dev, PLATFORM_DEVID_AUTO,
+ ls2k_bmc_cells, ARRAY_SIZE(ls2k_bmc_cells),
+ &dev->resource[0], 0, NULL);
+ if (ret)
+ goto disable_pci;
+
+ return 0;
disable_pci:
pci_disable_device(dev);
--
2.51.0
next prev parent reply other threads:[~2025-10-03 9:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-03 9:28 [PATCH 0/2] mfd: ls2kbmc: Fix a couple Smatch warnings Dan Carpenter
2025-10-03 9:29 ` [PATCH 1/2] mfd: ls2kbmc: Fix an IS_ERR() vs NULL check in probe() Dan Carpenter
2025-10-03 9:29 ` Dan Carpenter [this message]
2025-10-03 15:38 ` [PATCH 0/2] mfd: ls2kbmc: Fix a couple Smatch warnings Corey Minyard
2025-10-08 14:03 ` Lee Jones
2025-10-09 9:56 ` Lee Jones
2025-10-09 3:07 ` Huacai Chen
2025-10-09 10:01 ` Lee Jones
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=e3e7cf2cfded48c9fca8bc981c54bbcb7edb9580.1759478975.git.dan.carpenter@linaro.org \
--to=dan.carpenter@linaro.org \
--cc=chenhuacai@kernel.org \
--cc=corey@minyard.net \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qiaochong@loongson.cn \
--cc=zhoubinbin@loongson.cn \
/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®