mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-kernel@vger.kernel.org>
Cc: <chenhuacai@kernel.org>, <lvjianmin@loongson.cn>,
	<chenhuacai@loongson.cn>
Subject: [PATCH -next 2/3] platform/loongarch: laptop: add missing generic_subdriver_exit() in generic_acpi_laptop_init()
Date: Sun, 9 Oct 2022 11:40:08 +0800	[thread overview]
Message-ID: <20221009034009.60026-3-yangyingliang@huawei.com> (raw)
In-Reply-To: <20221009034009.60026-1-yangyingliang@huawei.com>

Add missing generic_subdriver_exit() in generic_acpi_laptop_init()
in error path.

Fixes: ee7fa5029de8 ("LoongArch: Add ACPI-based generic laptop driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/platform/loongarch/loongson-laptop.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/platform/loongarch/loongson-laptop.c b/drivers/platform/loongarch/loongson-laptop.c
index d9f82c3991c0..a9fdfac50f35 100644
--- a/drivers/platform/loongarch/loongson-laptop.c
+++ b/drivers/platform/loongarch/loongson-laptop.c
@@ -582,6 +582,8 @@ static int __init generic_acpi_laptop_init(void)
 	for (i = 0; i < ARRAY_SIZE(generic_sub_drivers); i++) {
 		ret = generic_subdriver_init(&generic_sub_drivers[i]);
 		if (ret < 0) {
+			while (--i >= 0)
+				generic_subdriver_exit(&generic_sub_drivers[i]);
 			input_free_device(generic_inputdev);
 			return ret;
 		}
@@ -589,6 +591,8 @@ static int __init generic_acpi_laptop_init(void)
 
 	ret = input_register_device(generic_inputdev);
 	if (ret < 0) {
+		while (--i >= 0)
+			generic_subdriver_exit(&generic_sub_drivers[i]);
 		input_free_device(generic_inputdev);
 		pr_err("Unable to register input device\n");
 		return ret;
-- 
2.25.1


  parent reply	other threads:[~2022-10-09  3:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-09  3:40 [PATCH -next 0/3] platform/loongarch: laptop: fix some issues Yang Yingliang
2022-10-09  3:40 ` [PATCH -next 1/3] platform/loongarch: laptop: add missing platform_driver_unregister() in generic_subdriver_exit() Yang Yingliang
2022-10-09  3:40 ` Yang Yingliang [this message]
2022-10-09  3:40 ` [PATCH -next 3/3] platform/loongarch: laptop: remove unnecessary BUG_ON in generic_subdriver_init() Yang Yingliang
2022-10-09  6:15 ` [PATCH -next 0/3] platform/loongarch: laptop: fix some issues Huacai Chen

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=20221009034009.60026-3-yangyingliang@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=chenhuacai@kernel.org \
    --cc=chenhuacai@loongson.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvjianmin@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®