From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751977AbcAAOp5 (ORCPT ); Fri, 1 Jan 2016 09:45:57 -0500 Received: from violet.fr.zoreil.com ([92.243.8.30]:42771 "EHLO violet.fr.zoreil.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751483AbcAAOpw (ORCPT ); Fri, 1 Jan 2016 09:45:52 -0500 Date: Fri, 1 Jan 2016 15:45:15 +0100 From: Francois Romieu To: Julia Lawall Cc: SF Markus Elfring , netdev@vger.kernel.org, Claudiu Manoil , LKML , kernel-janitors@vger.kernel.org Subject: Re: [PATCH 1/3] net-gianfar: Less function calls in gfar_ethflow_to_filer_table() after error detection Message-ID: <20160101144515.GA2273@electric-eye.fr.zoreil.com> References: <566ABCD9.1060404@users.sourceforge.net> <56866E7F.8080609@users.sourceforge.net> <56866F68.6070904@users.sourceforge.net> <56867607.4090907@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Organisation: Land of Sunshine Inc. User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Julia Lawall : > On Fri, 1 Jan 2016, SF Markus Elfring wrote: [...] > > > Normally, one returns -ENOMEM for this case, but it looks like this > > > function is returning 0 on failure. > > > > Should a symbol like "false" be used instead of such a special number? > > Maybe it's better than 0 and 1... Your suggestion about -ENOMEM is consistent with the callchain. Nothing else is needed. Btw: 1. kfree does not care about NULL parameter, especially in this hardly timing sensitive path. 2. kmalloc_array for small kernel controlled arrays of integers (see drivers/net/ethernet/freescale/gianfar.h), seriously ? I'd suggest the janitor to introduce a dedicated struct to embed both gfar_private.ftp_rqf{p, c}r then use a single, plain kmalloc in gfar_ethflow_to_filer_table. Happy tasteful 2016 :o) -- Ueimor