From patchwork Thu Sep 29 09:10:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9357745 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6C7B0600C8 for ; Fri, 30 Sep 2016 08:05:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FC0529EB0 for ; Fri, 30 Sep 2016 08:05:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53E9429EB2; Fri, 30 Sep 2016 08:05:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D882629EB0 for ; Fri, 30 Sep 2016 08:05:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8U82qNK011605; Fri, 30 Sep 2016 04:02:53 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u8T9AJ0T007864 for ; Thu, 29 Sep 2016 05:10:19 -0400 Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8T9AIAv005717 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 29 Sep 2016 05:10:18 -0400 Received: from mout.web.de (mout.web.de [212.227.17.12]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8A332A3259; Thu, 29 Sep 2016 09:10:17 +0000 (UTC) Received: from [192.168.1.2] ([78.49.118.68]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0LbrUu-1b6LER0AEO-00jGKS; Thu, 29 Sep 2016 11:10:15 +0200 To: dm-devel@redhat.com, linux-raid@vger.kernel.org, Alasdair Kergon , Mike Snitzer , Shaohua Li References: <566ABCD9.1060404@users.sourceforge.net> <080668d9-1e1e-e208-f9ea-ff718e8070e5@users.sourceforge.net> From: SF Markus Elfring Message-ID: <0204c749-986d-b419-73ca-23458916a31e@users.sourceforge.net> Date: Thu, 29 Sep 2016 11:10:07 +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: <080668d9-1e1e-e208-f9ea-ff718e8070e5@users.sourceforge.net> X-Provags-ID: V03:K0:tmOHjogUCsPvc8rFNuBeyigfY6pNpjxYoQWFTv5nyuviylYxYGI UbmQvG7KyXzryoUFvmlgTeEGuBb1o8UeC8+2xJJlUrfdjARnizyUxs3CSdO80I9SGprdSty 8Ha6zvl8S7+xQeanUrNnAnZj4pA/jxJYL4uXpu5Ak+onvz4bVgyjx9/VEaj+iKuv2zPPj5q yO4s5Ctgc8P0dc/zQyUuQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Qty6oHjBN1s=:xY0oB7zQ5uBwa+ecPJdhHM mmt+ieqZDZ7q+ZMnd3UPMON7TJiMp+wolhT5uQvqhSO+hD5TNkeSX+HMtuy6wsQC6zFQOzrNY LDOP1mqBVvvjPZYp+fMBd2HhoXkV282bK20uANclcyql4jS8Q9dQFXkV1GvwaTlv47zaYYw5i k3IsmRT02bqgFme9km3nd8dCcJOsbbjC77+6nXSosT/t5BlAG0JzsVAJwB11Xs1yyVxCrx/Tw 2zjRZMPRlWm6ItR+UwrlWYNVNbglrtl4yZW+Dh2NETJ4D/DnZfVx8/XXjKpUwQFXl0SLANFit XxmtR2V9AjEyoL5i2x/k1rkpo1g2mhXzVM28mmrPPdINXCzNV6MPRqySUsM0chsZls/QGTBXU i8pXuhnFzsbHearVi6Oj1btJV6+bhigpvRsuJOIP/hLN+2GZHkFSnvllfdpGNGNecenuhkjno z9yayKcsVNXtUMWDKF5tcJjr2+Yn6KsHsrRsZMgx7PCVe0RAdH1nMhVeF7wbuPfbfxc4vw/0y SB3VwM4QmwWcgl0iaa45TqoBSGHXSvFo8SBhSchzTbGGwe9rAwOINwUVtbNlMHMSTHiaMbF2A 613UBqbYemvqUBAJNBwMHyoL9aSV+AmtykD39vD631l2fuqxKlR9gCcDdEOQEMrjt5q5VueHv d658TpRJYazTDbWTTG6xgZTxn3QLZPObc2iwGfmCNq5Maa6S4fMfXqAK1UAP9JoYGMzGnusHg p/y4upAhKeR7XmId2Si17+XE8KR1r+52zsOK+mxs+0MPz3pnHn6qv0ILcfn4ztNtIDm0NY2qo VFp8/u3 X-Greylist: Sender IP whitelisted by DNSRBL, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 29 Sep 2016 09:10:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 29 Sep 2016 09:10:18 +0000 (UTC) for IP:'212.227.17.12' DOMAIN:'mout.web.de' HELO:'mout.web.de' FROM:'elfring@users.sourceforge.net' RCPT:'' X-RedHat-Spam-Score: 0.079 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 212.227.17.12 mout.web.de 212.227.17.12 mout.web.de X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Fri, 30 Sep 2016 04:02:16 -0400 Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML , Wolfram Sang Subject: [dm-devel] [PATCH 02/10] dm snapshot: Delete two error messages for a failed memory allocation X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Wed, 28 Sep 2016 22:33:09 +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/dm-snap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index f262f7e..7d81390 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -329,10 +329,8 @@ static int init_origin_hash(void) _origins = kmalloc_array(ORIGIN_HASH_SIZE, sizeof(*_origins), GFP_KERNEL); - if (!_origins) { - DMERR("unable to allocate memory for _origins"); + if (!_origins) return -ENOMEM; - } for (i = 0; i < ORIGIN_HASH_SIZE; i++) INIT_LIST_HEAD(_origins + i); @@ -340,7 +338,6 @@ static int init_origin_hash(void) sizeof(*_dm_origins), GFP_KERNEL); if (!_dm_origins) { - DMERR("unable to allocate memory for _dm_origins"); kfree(_origins); return -ENOMEM; }