From: Zheng Bin <zhengbin13@huawei.com>
To: <mpe@ellerman.id.au>, <benh@kernel.crashing.org>,
<paulus@samba.org>, <haren@linux.ibm.com>,
<gregkh@linuxfoundation.org>, <npiggin@gmail.com>,
<linuxppc-dev@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>
Cc: zhengbin13@huawei.com, gaochao49@huawei.com
Subject: [PATCH -next] powerpc/pseries/vas: Call misc_deregister if sysfs init fails
Date: Wed, 11 May 2022 11:35:07 +0800 [thread overview]
Message-ID: <20220511033507.2745992-1-zhengbin13@huawei.com> (raw)
Undo effects of misc_register if sysfs init fails after
misc_register.
Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
---
arch/powerpc/platforms/pseries/vas-sysfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/platforms/pseries/vas-sysfs.c b/arch/powerpc/platforms/pseries/vas-sysfs.c
index ec65586cbeb3..89ed64d61da7 100644
--- a/arch/powerpc/platforms/pseries/vas-sysfs.c
+++ b/arch/powerpc/platforms/pseries/vas-sysfs.c
@@ -248,6 +248,7 @@ int __init sysfs_pseries_vas_init(struct vas_all_caps *vas_caps)
pseries_vas_kobj = kobject_create_and_add("vas0",
&vas_miscdev.this_device->kobj);
if (!pseries_vas_kobj) {
+ misc_deregister(&vas_miscdev);
pr_err("Failed to create VAS sysfs entry\n");
return -ENOMEM;
}
@@ -259,6 +260,7 @@ int __init sysfs_pseries_vas_init(struct vas_all_caps *vas_caps)
if (!gzip_caps_kobj) {
pr_err("Failed to create VAS GZIP capability entry\n");
kobject_put(pseries_vas_kobj);
+ misc_deregister(&vas_miscdev);
return -ENOMEM;
}
}
--
2.31.1
next reply other threads:[~2022-05-11 3:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 3:35 Zheng Bin [this message]
2022-05-24 11:09 ` [PATCH -next] powerpc/pseries/vas: Call misc_deregister if sysfs init fails Michael Ellerman
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=20220511033507.2745992-1-zhengbin13@huawei.com \
--to=zhengbin13@huawei.com \
--cc=benh@kernel.crashing.org \
--cc=gaochao49@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=haren@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=paulus@samba.org \
/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;
as well as URLs for NNTP newsgroup(s).