Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755461AbbLAQTg (ORCPT ); Tue, 1 Dec 2015 11:19:36 -0500 Received: from mail1.bemta8.messagelabs.com ([216.82.243.194]:10265 "EHLO mail1.bemta8.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753877AbbLAQTe (ORCPT ); Tue, 1 Dec 2015 11:19:34 -0500 X-Greylist: delayed 386 seconds by postgrey-1.27 at vger.kernel.org; Tue, 01 Dec 2015 11:19:34 EST X-Env-Sender: Benjamin.Romer@unisys.com X-Msg-Ref: server-12.tower-99.messagelabs.com!1448986372!4341289!17 X-Originating-IP: [192.61.61.104] X-StarScan-Received: X-StarScan-Version: 7.19.2; banners=-,-,- X-VirusChecked: Checked Subject: Re: [PATCH] staging: unisys: use common return path To: Dan Carpenter References: <1448950555-8846-1-git-send-email-sudipm.mukherjee@gmail.com> <20151201080045.GE18797@mwanda> <565DB4BA.80208@unisys.com> <20151201155724.GG18797@mwanda> CC: Sudip Mukherjee , , Greg Kroah-Hartman , , From: Ben Romer Message-ID: <565DC7D0.3000307@unisys.com> Date: Tue, 1 Dec 2015 11:16:16 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151201155724.GG18797@mwanda> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [192.63.205.71] X-ClientProxiedBy: US-EXCH13-2.na.uis.unisys.com (129.224.78.76) To US-EXCH13-1.na.uis.unisys.com (129.224.78.75) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1497 Lines: 40 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. >> >> If we *have* to change it > > I don't think we have to change it at all. Using direct returns makes > finding locking bugs easier for static checkers. > That's true, and I think the code is fine as it is. >> spin_unlock_irqrestore(&devdata->priv_lock, flags); > > This is a bug. > Indeed, but I'd rather not have any of these changes made anyway. This function isn't broken so it doesn't need to be fixed. -- Ben -- 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/