Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750829AbbLBFB1 (ORCPT ); Wed, 2 Dec 2015 00:01:27 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:36496 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750702AbbLBFBZ (ORCPT ); Wed, 2 Dec 2015 00:01:25 -0500 Date: Wed, 2 Dec 2015 10:31:18 +0530 From: Sudip Mukherjee To: Ben Romer Cc: Dan Carpenter , devel@driverdev.osuosl.org, Greg Kroah-Hartman , sparmaintainer@unisys.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: unisys: use common return path Message-ID: <20151202050118.GB3692@sudip-pc> References: <1448950555-8846-1-git-send-email-sudipm.mukherjee@gmail.com> <20151201080045.GE18797@mwanda> <565DB4BA.80208@unisys.com> <20151201155724.GG18797@mwanda> <565DC7D0.3000307@unisys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <565DC7D0.3000307@unisys.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1576 Lines: 37 On Tue, Dec 01, 2015 at 11:16:16AM -0500, Ben Romer wrote: > On 12/01/2015 10:57 AM, Dan Carpenter wrote: > >What I meant was that I'm generally opposed to "common exit paths". > >Mixing all the exit paths together often makes the code more complicated > >and leads to errors. That makes sense from a common sense perspective > >that doing many things is more difficult than doing one thing? Anyway > >it's easy enough to verify empirically that this style is bug prone. > > > >On the other hand there are times where all exit paths need to unlock or > >to free a variable and in those cases using a common exit path makes > >sense. Just don't standardize on "Every function should only have a > >single return". > > > > That works for me. Mainly my issue with it is that I've spent a lot > of time trying to eliminate "goto Away" code from the drivers, so > I'd rather not put any back if possible. But what is wrong with goto? Quoting from CodingStyle: "The goto statement comes in handy when a function exits from multiple locations and some common work such as cleanup has to be done. If there is no cleanup needed then just return directly." I am absolutely fine if you don't want it to be applied but just for knowing - It has multiple exits. In this case spin_unlock_irqrestore() is the common work. regards sudip -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/