From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Subject: [PATCH 2/3] staging: most: return proper error
Date: Sun, 22 Nov 2015 22:30:55 +0530 [thread overview]
Message-ID: <1448211656-15829-2-git-send-email-sudipm.mukherjee@gmail.com> (raw)
In-Reply-To: <1448211656-15829-1-git-send-email-sudipm.mukherjee@gmail.com>
We were returning ENOMEM on all types of errors. Lets return the actual
error code. At the same time remove the label which became unused as a
result of this patch.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
drivers/staging/most/mostcore/core.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c
index 07f11dd..619d558 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -1913,31 +1913,38 @@ EXPORT_SYMBOL_GPL(most_resume_enqueue);
static int __init most_init(void)
{
+ int err;
+
pr_info("init()\n");
INIT_LIST_HEAD(&instance_list);
INIT_LIST_HEAD(&aim_list);
mutex_init(&deregister_mutex);
ida_init(&mdev_id);
- if (bus_register(&most_bus)) {
+ err = bus_register(&most_bus);
+ if (err) {
pr_info("Cannot register most bus\n");
- goto exit;
+ return err;
}
most_class = class_create(THIS_MODULE, "most");
if (IS_ERR(most_class)) {
pr_info("No udev support.\n");
+ err = PTR_ERR(most_class);
goto exit_bus;
}
- if (driver_register(&mostcore)) {
+ err = driver_register(&mostcore);
+ if (err) {
pr_info("Cannot register core driver\n");
goto exit_class;
}
class_glue_dir =
device_create(most_class, NULL, 0, NULL, "mostcore");
- if (IS_ERR(class_glue_dir))
+ if (IS_ERR(class_glue_dir)) {
+ err = -ENOMEM;
goto exit_driver;
+ }
most_aim_kset =
kset_create_and_add("aims", NULL, &class_glue_dir->kobj);
@@ -1946,8 +1953,10 @@ static int __init most_init(void)
most_inst_kset =
kset_create_and_add("devices", NULL, &class_glue_dir->kobj);
- if (!most_inst_kset)
+ if (!most_inst_kset) {
+ err = -ENOMEM;
goto exit_driver_kset;
+ }
return 0;
@@ -1961,8 +1970,7 @@ exit_class:
class_destroy(most_class);
exit_bus:
bus_unregister(&most_bus);
-exit:
- return -ENOMEM;
+ return err;
}
static void __exit most_exit(void)
--
1.9.1
next prev parent reply other threads:[~2015-11-22 17:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-22 17:00 [PATCH 1/3] staging: most: fix error comparison Sudip Mukherjee
2015-11-22 17:00 ` Sudip Mukherjee [this message]
2016-02-07 22:14 ` [PATCH 2/3] staging: most: return proper error Greg Kroah-Hartman
2016-02-08 18:10 ` Sudip Mukherjee
2015-11-22 17:00 ` [PATCH 3/3] staging: most: fix id leak Sudip Mukherjee
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=1448211656-15829-2-git-send-email-sudipm.mukherjee@gmail.com \
--to=sudipm.mukherjee@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.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).