From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932460AbcGZTGD (ORCPT ); Tue, 26 Jul 2016 15:06:03 -0400 Received: from mout.web.de ([212.227.15.3]:58491 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932258AbcGZTF7 (ORCPT ); Tue, 26 Jul 2016 15:05:59 -0400 Subject: [PATCH 05/12] staging: lustre: Optimize error handling in class_register_type() To: devel@driverdev.osuosl.org, lustre-devel@lists.lustre.org, Andreas Dilger , Greg Kroah-Hartman , Oleg Drokin References: <566ABCD9.1060404@users.sourceforge.net> <566D7733.1030102@users.sourceforge.net> <56784D83.7080108@users.sourceforge.net> <56784F0C.6040007@users.sourceforge.net> <20151221234857.GA27079@kroah.com> <59d94e70-7476-728e-5f63-013557ec2db9@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall , Bhumika Goyal From: SF Markus Elfring Message-ID: Date: Tue, 26 Jul 2016 21:05:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: <59d94e70-7476-728e-5f63-013557ec2db9@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:gkzH3esrhmfezI8wXt5mlehJIxTNzodDPi9fIYeq31WSS9bemlX cfdjxtpl9mTtsuKvP8JPbG3MO3O+B3qnJRzElzTahAL7PAs0SO8Ui1kfvZpqtOC7e95cBdj yGbRXcb8zuaYi+XxhLSFG5mtqQKqjjXKpMCsdm3OBvevkAD4ubQiQXp+Nvlc1AVqwAUA4uR aQInevOEI7diWRfCJ5yTQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:FMY2fKZ5N9w=:QJnP33Q18gJ9oHVbc9pOjb 4lbRigpuosu9Jb5gZj4bXFn3pFCDP/ufkT95Mvi8DH/1RUvkWD8mz2Ip50QgGt8QMpBqCvGfS cw8zwTRti/qnoLWWW+jDnpPPu/Yqc6vtMD6/FcxH2oQdhfIIrKFMI7t2ec/JmA5GaFeS8bzJr UOBS2Bwl+Z5ncWlyDdpceZOvVt/4m56TBDRuPOWd+aS1CFKpEQEKiUp7rISOasbzNz0xDf++X SRC6x5l3Ea4JmIXcTOmFY9+pi9KcMzvQsTB+JDob25b+9Ch0rncygDXrLrbSaAd4+KEZ+G5K7 ReQCqTdTdaqFWfwS+nZpWcDUiC5ADBXKnq7gFCgv73J0ACUOK495Tv4iitTdHIaNLGmBFqj7i hHEgIoFVIsY7J3KkGD2BFQr7H1UGD+4ydnh25VCgcGLirVVq22vg4WvmepVrln78GnPu7XhyY XJyBm2F/DM7YLGJZAsH7Kyai/56JMUXxCFI3r2WAtc/kIhqmhYN/QvStT2uwbv4cMdCz5c/2p AzoHWxLee5MP66/Ogf1s6ti08FuKxHng1YKBnaGK9d4wswNlGedF42YIrDOLq6+EiJDh/lNRg kFPs0a3A6AJmnZX0162Cf81Ytxq3xb/HT1EOh+QUmQ3w9/rcGWoopz9m9QnNcCZa6stNMHpNX va2uMoCjqd10dBy32OlhWyopuUxXVyWzk5HrRwagj6t4Ter8Mm1sucOk1mtsrrARXK3kuAeHC 2ixdfC7q3wk6EVLA7CeY1tsjv3V3AggdvnUiYGxB3XM3dB9iyGxbspeFmnZsieEvpqconHmgh u1+fKC8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Tue, 26 Jul 2016 14:23:23 +0200 Return a constant error code without storing it in the local variable "rc" after a failed memory allocation at the beginning of this function. Signed-off-by: Markus Elfring --- drivers/staging/lustre/lustre/obdclass/genops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index fd5e61f..4752091 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -152,10 +152,9 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, return -EEXIST; } - rc = -ENOMEM; type = kzalloc(sizeof(*type), GFP_NOFS); if (!type) - return rc; + return -ENOMEM; type->typ_dt_ops = kzalloc(sizeof(*type->typ_dt_ops), GFP_NOFS); if (!type->typ_dt_ops) { -- 2.9.2 From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Date: Tue, 26 Jul 2016 19:05:48 +0000 Subject: [PATCH 05/12] staging: lustre: Optimize error handling in class_register_type() Message-Id: List-Id: References: <566ABCD9.1060404@users.sourceforge.net> <566D7733.1030102@users.sourceforge.net> <56784D83.7080108@users.sourceforge.net> <56784F0C.6040007@users.sourceforge.net> <20151221234857.GA27079@kroah.com> <59d94e70-7476-728e-5f63-013557ec2db9@users.sourceforge.net> In-Reply-To: <59d94e70-7476-728e-5f63-013557ec2db9@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: devel@driverdev.osuosl.org, lustre-devel@lists.lustre.org, Andreas Dilger , Greg Kroah-Hartman , Oleg Drokin Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall , Bhumika Goyal From: Markus Elfring Date: Tue, 26 Jul 2016 14:23:23 +0200 Return a constant error code without storing it in the local variable "rc" after a failed memory allocation at the beginning of this function. Signed-off-by: Markus Elfring --- drivers/staging/lustre/lustre/obdclass/genops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index fd5e61f..4752091 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -152,10 +152,9 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, return -EEXIST; } - rc = -ENOMEM; type = kzalloc(sizeof(*type), GFP_NOFS); if (!type) - return rc; + return -ENOMEM; type->typ_dt_ops = kzalloc(sizeof(*type->typ_dt_ops), GFP_NOFS); if (!type->typ_dt_ops) { -- 2.9.2 From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Date: Tue, 26 Jul 2016 21:05:48 +0200 Subject: [lustre-devel] [PATCH 05/12] staging: lustre: Optimize error handling in class_register_type() In-Reply-To: <59d94e70-7476-728e-5f63-013557ec2db9@users.sourceforge.net> References: <566ABCD9.1060404@users.sourceforge.net> <566D7733.1030102@users.sourceforge.net> <56784D83.7080108@users.sourceforge.net> <56784F0C.6040007@users.sourceforge.net> <20151221234857.GA27079@kroah.com> <59d94e70-7476-728e-5f63-013557ec2db9@users.sourceforge.net> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: devel@driverdev.osuosl.org, lustre-devel@lists.lustre.org, Andreas Dilger , Greg Kroah-Hartman , Oleg Drokin Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall , Bhumika Goyal From: Markus Elfring Date: Tue, 26 Jul 2016 14:23:23 +0200 Return a constant error code without storing it in the local variable "rc" after a failed memory allocation at the beginning of this function. Signed-off-by: Markus Elfring --- drivers/staging/lustre/lustre/obdclass/genops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index fd5e61f..4752091 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -152,10 +152,9 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, return -EEXIST; } - rc = -ENOMEM; type = kzalloc(sizeof(*type), GFP_NOFS); if (!type) - return rc; + return -ENOMEM; type->typ_dt_ops = kzalloc(sizeof(*type->typ_dt_ops), GFP_NOFS); if (!type->typ_dt_ops) { -- 2.9.2