[PATCH 3/13] md/multipath: Delete four error messages for a failed memory allocation
From: SF Markus Elfring
Date: Sun Oct 02 2016 - 07:59:41 EST
From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 1 Oct 2016 21:15:45 +0200
Omit extra messages for a memory allocation failure in this function.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/md/multipath.c | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index 7fdabb1..be7c0b9 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -401,22 +401,14 @@ static int multipath_run (struct mddev *mddev)
conf = kzalloc(sizeof(*conf), GFP_KERNEL);
mddev->private = conf;
- if (!conf) {
- printk(KERN_ERR
- "multipath: couldn't allocate memory for %s\n",
- mdname(mddev));
+ if (!conf)
goto out;
- }
conf->multipaths = kcalloc(mddev->raid_disks,
sizeof(*conf->multipaths),
GFP_KERNEL);
- if (!conf->multipaths) {
- printk(KERN_ERR
- "multipath: couldn't allocate memory for %s\n",
- mdname(mddev));
+ if (!conf->multipaths)
goto out_free_conf;
- }
working_disks = 0;
rdev_for_each(rdev, mddev) {
@@ -448,21 +440,14 @@ static int multipath_run (struct mddev *mddev)
conf->pool = mempool_create_kmalloc_pool(NR_RESERVED_BUFS,
sizeof(struct multipath_bh));
- if (conf->pool == NULL) {
- printk(KERN_ERR
- "multipath: couldn't allocate memory for %s\n",
- mdname(mddev));
+ if (!conf->pool)
goto out_free_conf;
- }
{
mddev->thread = md_register_thread(multipathd, mddev,
"multipath");
- if (!mddev->thread) {
- printk(KERN_ERR "multipath: couldn't allocate thread"
- " for %s\n", mdname(mddev));
+ if (!mddev->thread)
goto out_free_conf;
- }
}
printk(KERN_INFO
--
2.10.0