From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vps0.lunn.ch ([185.16.172.187]:37458 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750876AbeBZRZ2 (ORCPT ); Mon, 26 Feb 2018 12:25:28 -0500 Date: Mon, 26 Feb 2018 18:25:22 +0100 From: Andrew Lunn To: Bryan.Whitehead@microchip.com Cc: f.fainelli@gmail.com, davem@davemloft.net, UNGLinuxDriver@microchip.com, netdev@vger.kernel.org Subject: Re: [PATCH v2 net-next 1/2] lan743x: Add main source files for new lan743x driver Message-ID: <20180226172522.GH3775@lunn.ch> References: <1519240015-10263-1-git-send-email-Bryan.Whitehead@microchip.com> <1519240015-10263-2-git-send-email-Bryan.Whitehead@microchip.com> <2461f47f-1a5b-ed46-116b-35f683ab0206@gmail.com> <90A7E81AE28BAE4CBDDB3B35F187D2644071DF4F@CHN-SV-EXMX02.mchp-main.com> <20180224020644.GA32711@lunn.ch> <90A7E81AE28BAE4CBDDB3B35F187D2644071E1A9@CHN-SV-EXMX02.mchp-main.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <90A7E81AE28BAE4CBDDB3B35F187D2644071E1A9@CHN-SV-EXMX02.mchp-main.com> Sender: netdev-owner@vger.kernel.org List-ID: > But the other case is when things fail anywhere during probe, or > open. In these cases things are partially initialized and I assumed > I needed to clean up whatever was initialized successfully before > returning an error. I used flags so I could share a common clean up > function for all possible error cases as well as the fully > successful case. Without flags I would need to customize a clean-up > sequence for each possible error point. Hi Bryan It is good to look at other drivers and see how they work. Ideally, your driver wants to look similar to all other drivers, so making the maintenance easier. You will find that most drivers have a set of goto statements for error handling, which jump to the end of the function, and do cleanup. No flags are maintained. Andrew