From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752830AbbLLOqF (ORCPT ); Sat, 12 Dec 2015 09:46:05 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:36790 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751032AbbLLOqD (ORCPT ); Sat, 12 Dec 2015 09:46:03 -0500 X-IronPort-AV: E=Sophos;i="5.20,417,1444687200"; d="scan'208";a="191738594" Date: Sat, 12 Dec 2015 15:45:55 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: SF Markus Elfring cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, "Nicholas A. Bellinger" , LKML , kernel-janitors@vger.kernel.org Subject: Re: [PATCH 4/7] iscsi-target: Make a variable initialisation a bit more obvious in iscsi_create_default_params() In-Reply-To: <566C3225.4070100@users.sourceforge.net> Message-ID: References: <566ABCD9.1060404@users.sourceforge.net> <566C2F7B.6030704@users.sourceforge.net> <566C3225.4070100@users.sourceforge.net> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 12 Dec 2015, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sat, 12 Dec 2015 13:44:06 +0100 > > The variable "pl" was declared and immediately assigned a return value > from a function call in a separate statement. > > * Let us express the desired variable initialisation directly. > > * Avoid the repetition of the data type specification for the > involved memory allocation according to the Linux coding > style convention. > > Signed-off-by: Markus Elfring > --- > drivers/target/iscsi/iscsi_target_parameters.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c > index e0b173d..3f3842f 100644 > --- a/drivers/target/iscsi/iscsi_target_parameters.c > +++ b/drivers/target/iscsi/iscsi_target_parameters.c > @@ -200,9 +200,8 @@ free_param: > int iscsi_create_default_params(struct iscsi_param_list **param_list_ptr) > { > struct iscsi_param *param; > - struct iscsi_param_list *pl; > + struct iscsi_param_list *pl = kzalloc(sizeof(*pl), GFP_KERNEL); > > - pl = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); I don't see the benefit of this change, and the pattern assignment -> failure test becomes more obscure. julia > if (!pl) { > pr_err("Unable to allocate memory for" > " struct iscsi_param_list.\n"); > -- > 2.6.3 > > -- > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julia Lawall Date: Sat, 12 Dec 2015 14:45:55 +0000 Subject: Re: [PATCH 4/7] iscsi-target: Make a variable initialisation a bit more obvious in iscsi_create_defa Message-Id: List-Id: References: <566ABCD9.1060404@users.sourceforge.net> <566C2F7B.6030704@users.sourceforge.net> <566C3225.4070100@users.sourceforge.net> In-Reply-To: <566C3225.4070100@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: SF Markus Elfring Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, "Nicholas A. Bellinger" , LKML , kernel-janitors@vger.kernel.org On Sat, 12 Dec 2015, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sat, 12 Dec 2015 13:44:06 +0100 > > The variable "pl" was declared and immediately assigned a return value > from a function call in a separate statement. > > * Let us express the desired variable initialisation directly. > > * Avoid the repetition of the data type specification for the > involved memory allocation according to the Linux coding > style convention. > > Signed-off-by: Markus Elfring > --- > drivers/target/iscsi/iscsi_target_parameters.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c > index e0b173d..3f3842f 100644 > --- a/drivers/target/iscsi/iscsi_target_parameters.c > +++ b/drivers/target/iscsi/iscsi_target_parameters.c > @@ -200,9 +200,8 @@ free_param: > int iscsi_create_default_params(struct iscsi_param_list **param_list_ptr) > { > struct iscsi_param *param; > - struct iscsi_param_list *pl; > + struct iscsi_param_list *pl = kzalloc(sizeof(*pl), GFP_KERNEL); > > - pl = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); I don't see the benefit of this change, and the pattern assignment -> failure test becomes more obscure. julia > if (!pl) { > pr_err("Unable to allocate memory for" > " struct iscsi_param_list.\n"); > -- > 2.6.3 > > -- > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >