From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alasdair Kergon <agk@redhat.com>
Cc: Mike Snitzer <snitzer@redhat.com>,
dm-devel@redhat.com, Neil Brown <neilb@suse.de>,
linux-raid@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] dm: fix an error code in local_init()
Date: Tue, 8 Jul 2014 13:55:36 +0300 [thread overview]
Message-ID: <20140708105536.GC19737@mwanda> (raw)
We return success if we can't allocate a work queue but we should return
-ENOMEM. The code was a bit messy so that's why this small bug was
introduced and I have cleaned that as well.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 3281615..aa2b12e 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -263,12 +263,12 @@ EXPORT_SYMBOL_GPL(dm_get_reserved_rq_based_ios);
static int __init local_init(void)
{
- int r = -ENOMEM;
+ int r;
/* allocate a slab for the dm_ios */
_io_cache = KMEM_CACHE(dm_io, 0);
if (!_io_cache)
- return r;
+ return -ENOMEM;
_rq_tio_cache = KMEM_CACHE(dm_rq_target_io, 0);
if (!_rq_tio_cache)
@@ -279,8 +279,10 @@ static int __init local_init(void)
goto out_free_rq_tio_cache;
deferred_remove_workqueue = alloc_workqueue("kdmremove", WQ_UNBOUND, 1);
- if (!deferred_remove_workqueue)
+ if (!deferred_remove_workqueue) {
+ r = -ENOMEM;
goto out_uevent_exit;
+ }
_major = major;
r = register_blkdev(_major, _name);
next reply other threads:[~2014-07-08 10:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-08 10:55 Dan Carpenter [this message]
2014-07-08 16:21 ` dm: fix an error code in local_init() Mike Snitzer
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=20140708105536.GC19737@mwanda \
--to=dan.carpenter@oracle.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
--cc=snitzer@redhat.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;
as well as URLs for NNTP newsgroup(s).