Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751347AbcJBL7j (ORCPT ); Sun, 2 Oct 2016 07:59:39 -0400 Received: from mout.web.de ([212.227.17.11]:54149 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750833AbcJBL7a (ORCPT ); Sun, 2 Oct 2016 07:59:30 -0400 Subject: [PATCH 3/13] md/multipath: Delete four error messages for a failed memory allocation To: linux-raid@vger.kernel.org, Jens Axboe , NeilBrown , Shaohua Li References: <566ABCD9.1060404@users.sourceforge.net> <4a31d7a7-f70c-12f7-202f-963bd8706066@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall , Wolfram Sang From: SF Markus Elfring Message-ID: <6726e88c-2ad0-fd5e-6ef4-4f5e796a68b9@users.sourceforge.net> Date: Sun, 2 Oct 2016 13:59:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <4a31d7a7-f70c-12f7-202f-963bd8706066@users.sourceforge.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:gX5oCo936D0gJKa/moO2AZmS9OQbGk6lEM3HTy3dQvJULweduqt TS9BiUfjK7A8bU1doErKcEvsneXQ338y9jHqrDu8LBpFXEB670Gzmj/ofLCqJiaV8RUzzE0 WPHG1bQ4+aXtOznh0ZqBieX1brqonLF3CHnkSLHfUy/CbQQ8F+6qiBvfUQKjZwQFtFq0bGG PBZB3YuD+hYfuq0D8+KKg== X-UI-Out-Filterresults: notjunk:1;V01:K0:vWnuuuVJZEU=:9DAUzO0PpT+Cmgi3NOzwRl zZRgPo+obQk3AHl2+SUAIqCoPLC3w5bsCEIJEYhhSEV9dDaHqLut085OSWRtABpyXxgjrrLIH EP2vdc4EcPDYoe7sYCWb0bYF38QpWrxqquNyPKS600+6pha1GJhqyi+7UAIL4zd10pSQcrcmn OZU/JPhgmsAj+GshUzFCX3MzY5yCsV8NEZ+2gvvTBjCFf9oziHTZ177nxdHXC2ZU8C3Y3leX1 OajQj7C8OOqunF5DpoU18pgD1GZCgxtf+LGtV6QahqtKr5mTxX7xM6c7zstVpmgLFRp83kH/O 769d5NcMey3OELo8plSuofXbuW/BV2j2bPVRn+y2MRzjSccAxSZzYiJVOMNIguLYXU7TIhsIt Z7O61wFEo9YdBqcYSyp2a8t0/PTFRAm4YNiYkT726c6p/0SY1ZvJZMTkT38o0YMyGYZtBX73i cDyetNUY1dD3wVl9ASWymGT/nAB/On1pKmfP+OtBGOYZ9DLUrPQZuaBlTidf6gdN16x2jBsiJ fxCdj07ft3a7QxJmV7XFZANvCLZn43VrZw3VMFawG7laodufk6bzhFIcwgwUJPrED8WPzjcuH fklyCLvyGtd512CG/OlQO3uctNoX2QMpl86JtsTH2+jAUE2tnSWSqYxajvQvHsOITB1hZ3hzp ArkhJp9PZJbHfbrdNEnNlk4X+72vRG/GpXclkykeOL3j6wIZtRCDj42I3iqofGKPkFHEeKvdL 3BfSjRt1xmAahvubnjyE5dSvQ48j4Vi/j7Tb3K2SXUoHqYzToYmhwo7J5ckJWmZcZ4zhRlF6K QNllqhG Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1816 Lines: 66 From: Markus Elfring 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 --- 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