Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942470AbcJFJbK (ORCPT ); Thu, 6 Oct 2016 05:31:10 -0400 Received: from mout.web.de ([212.227.17.11]:54927 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S942429AbcJFJbH (ORCPT ); Thu, 6 Oct 2016 05:31:07 -0400 Subject: [PATCH 30/54] md/raid5: Delete two error messages for a failed memory allocation To: linux-raid@vger.kernel.org, Christoph Hellwig , Guoqing Jiang , Jens Axboe , Mike Christie , Neil Brown , Shaohua Li , Tomasz Majchrzak References: <566ABCD9.1060404@users.sourceforge.net> <786843ef-4b6f-eb04-7326-2f6f5b408826@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall , Wolfram Sang From: SF Markus Elfring Message-ID: <46ceb7a1-5b8e-989b-a896-9a6ff7fdf833@users.sourceforge.net> Date: Thu, 6 Oct 2016 11:30:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <786843ef-4b6f-eb04-7326-2f6f5b408826@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:Bul6s5qj7Ok38xf5WWSM2GdZ9/391aszaVEAf7cRM3W2IpUGtnb 9uRTTmG5XN6+p1HGRRnCWdKzPldk2FnfunoGLuaG2noZOgZMVxbcxM7LREct4TSZg1VqvhD a4oeV2YGhaEhZKk5a0xNmDVRdNFl4B/ezhcdcFT1G3xIPL0z9V9fEkw2jQX16t0FRV4AaRS WL3OSP0Q5JJ9vSdrUbyOQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:kYbWSeh3NNo=:6C7/uGvwcB1yGGDo4Erdi+ BGnC+6RHg08V0wBrPwy0yp9Fm58Dv7VroLsz55UKdb4RaaucEdn2NabG/mqitFFZnASGQpRs7 u3hlLCA8Uqq1/Lz2u7KkXLNUqKbdq5A51k4oorP41iBKKi6lucEepcPJ0RdpVtLBIKJY9NVIt 9IHXewryTzOWZvO80cjA6vHKwYGF9u8lZ2pbteHipmnbxmYAIBIbhbHEYPysHjPOpMuephEW4 4gWB61aQPFKMldAP7rU+4quPkpZr1pbhV84fG5kHUzSCvgnnY7rQH2ylYCzMrdIRlqXoTYgn3 YaI5Is6JPJcRK9oZvag82qQDZJWbCo3tWldELEYl2JTKYBP4iHh7o4xa3cA5C+po6jLsqWuc8 IfZa/5EuvrKf+EVGv6gMwRmtcSZkzmoweBZkdWFZs2SVGJMwoQGbsT/vXyO+G4aMglhcVP6nQ HZpnvXliesN0/N5H2Nw0dq3B2QB0N5oksi+YZL3Iy8bNShIyL+wXkbjLR/iJWCNLazedsy+j8 wCFjpt5vaDjPlB5d8u4Xb4fkCpagZotmApuOyZrGBd+aGOLDO3YlWcTxLR1vuMWZhHJRAG6Ed AYknZAR0jgCFivxZCtlNcm6q5GopsHEYPE2YY/CCt+tDhTvzG3nBEAKhocO44rYpbvSoEUm/B f4EHSPUz0kFfdVb1jwyPSQEFpkK0BNl9Es6lPk/XNUgPivuGPwEkVwVwTuE9gJAourhRRimkT pwSt5eBWaA4Vq9NBrUck0ZsgJ9iMBIwcLTT1C3VKJx2aAXowwKWiiigXWzHWUPjl/xskW30pl s2akFnn Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1557 Lines: 47 From: Markus Elfring Date: Wed, 5 Oct 2016 09:43:40 +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/raid5.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index d864871..ef180c0 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -6613,12 +6613,9 @@ static struct r5conf *setup_conf(struct mddev *mddev) memory = conf->min_nr_stripes * (sizeof(struct stripe_head) + max_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024; atomic_set(&conf->empty_inactive_list_nr, NR_STRIPE_HASH_LOCKS); - if (grow_stripes(conf, conf->min_nr_stripes)) { - printk(KERN_ERR - "md/raid:%s: couldn't allocate %dkB for buffers\n", - mdname(mddev), memory); + if (grow_stripes(conf, conf->min_nr_stripes)) goto free_conf; - } else + else printk(KERN_INFO "md/raid:%s: allocated %dkB\n", mdname(mddev), memory); /* @@ -6640,12 +6637,8 @@ static struct r5conf *setup_conf(struct mddev *mddev) sprintf(pers_name, "raid%d", mddev->new_level); conf->thread = md_register_thread(raid5d, mddev, pers_name); - if (!conf->thread) { - printk(KERN_ERR - "md/raid:%s: couldn't allocate thread.\n", - mdname(mddev)); + if (!conf->thread) goto free_conf; - } return conf; free_conf: -- 2.10.1