From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Tue, 10 Feb 2015 10:10:23 +0000 Subject: Re: [PATCH 1/1] staging: ozwpan: Remove allocation from delaration line Message-Id: <20150210101023.GF5206@mwanda> List-Id: References: <20150210085503.GA10872@sloth> In-Reply-To: <20150210085503.GA10872@sloth> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Quentin Lambert Cc: Shigekatsu Tateno , Greg Kroah-Hartman , devel@driverdev.osuosl.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org On Tue, Feb 10, 2015 at 09:55:03AM +0100, Quentin Lambert wrote: > static struct oz_endpoint *oz_ep_alloc(int buffer_size, gfp_t mem_flags) > { > - struct oz_endpoint *ep > - kzalloc(sizeof(struct oz_endpoint)+buffer_size, mem_flags); > + struct oz_endpoint *ep; > + > + ep = kzalloc(sizeof(struct oz_endpoint)+buffer_size, mem_flags); > + > if (ep) { Don't put a blank line between the function and the test. They are part of the same thing. Also in a later patch, could you reverse the "if (ep) " to if (!ep) return NULL; The original code is "success handling" not "error handling". regards, dan carpenter From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754541AbbBJKKa (ORCPT ); Tue, 10 Feb 2015 05:10:30 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:36893 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752640AbbBJKK2 (ORCPT ); Tue, 10 Feb 2015 05:10:28 -0500 Date: Tue, 10 Feb 2015 13:10:23 +0300 From: Dan Carpenter To: Quentin Lambert Cc: Shigekatsu Tateno , Greg Kroah-Hartman , devel@driverdev.osuosl.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] staging: ozwpan: Remove allocation from delaration line Message-ID: <20150210101023.GF5206@mwanda> References: <20150210085503.GA10872@sloth> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150210085503.GA10872@sloth> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: ucsinet22.oracle.com [156.151.31.94] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 10, 2015 at 09:55:03AM +0100, Quentin Lambert wrote: > static struct oz_endpoint *oz_ep_alloc(int buffer_size, gfp_t mem_flags) > { > - struct oz_endpoint *ep = > - kzalloc(sizeof(struct oz_endpoint)+buffer_size, mem_flags); > + struct oz_endpoint *ep; > + > + ep = kzalloc(sizeof(struct oz_endpoint)+buffer_size, mem_flags); > + > if (ep) { Don't put a blank line between the function and the test. They are part of the same thing. Also in a later patch, could you reverse the "if (ep) " to if (!ep) return NULL; The original code is "success handling" not "error handling". regards, dan carpenter