From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: Re: [PATCH v11 3/4] add FPGA manager core Date: Thu, 24 Sep 2015 10:49:53 +0300 Message-ID: <20150924074953.GI4953@mwanda> References: <1442935271-10375-1-git-send-email-atull@opensource.altera.com> <1442935271-10375-4-git-send-email-atull@opensource.altera.com> <20150922222929.GA26335@jcartwri.amer.corp.natinst.com> <20150923132354.GB31253@amd> <20150923141106.GH4953@mwanda> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" To: atull Cc: mark.rutland@arm.com, linux-doc@vger.kernel.org, linus.walleij@linaro.org, pantelis.antoniou@konsulko.com, hpa@zytor.com, s.trumtrar@pengutronix.de, devel@driverdev.osuosl.org, sameo@linux.intel.com, nico@linaro.org, iws@ovro.caltech.edu, michal.simek@xilinx.com, kyle.teske@ni.com, jgunthorpe@obsidianresearch.com, grant.likely@linaro.org, davidb@codeaurora.org, rubini@gnudd.com, cesarb@cesarb.net, devicetree@vger.kernel.org, jason@lakedaemon.net, pawel.moll@arm.com, ijc+devicetree@hellion.org.uk, Josh Cartwright , broonie@kernel.org, gregkh@linuxfoundation.org, philip@balister.org, Petr Cvek , dinguyen@opensource.altera.com, monstr@monstr.eu, Pavel Machek , linux-kernel@vger.kernel.org, balbi@ti.com, delicious.quinoa@gmail.com, robh+dt@kernel.org, rob@landley.net, galak@codeaurora.org, akpm@linux-foundation.org, davem@davemlo List-Id: devicetree@vger.kernel.org Of course, the maintainer gets the last word regardless of what anyone else thinks. Generally, minimal code is better. Trying to future proof code is a waste of time because you can't predict what will happen in the future. It's way more likely that some pointer you never expected to be NULL will be NULL instead of the few checked at the beginning of a function. Adding useless code uses RAM and makes the function slower. It's a bit confusing for users as well because they will wonder when the NULL check is used. A lot of times this sort of error handling is a bit fake and what I mean is that it looks correct but the system will just crash in a later function. Also especially with a simple NULL dereferences like this theoretical one, it's better to just get the oops. It kills the module but you get a good message in the log and it's normally straight forward to debug. We spent a surprising amount of time discussing useless code. I made someone redo a patch yesterday because they had incomplete error handling for a situation which could never happen. 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 S1756800AbbIXHwL (ORCPT ); Thu, 24 Sep 2015 03:52:11 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:29978 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755989AbbIXHwI (ORCPT ); Thu, 24 Sep 2015 03:52:08 -0400 Date: Thu, 24 Sep 2015 10:49:53 +0300 From: Dan Carpenter To: atull Cc: mark.rutland@arm.com, linux-doc@vger.kernel.org, rubini@gnudd.com, pantelis.antoniou@konsulko.com, linux-kernel@vger.kernel.org, hpa@zytor.com, s.trumtrar@pengutronix.de, devel@driverdev.osuosl.org, sameo@linux.intel.com, nico@linaro.org, iws@ovro.caltech.edu, michal.simek@xilinx.com, kyle.teske@ni.com, jgunthorpe@obsidianresearch.com, grant.likely@linaro.org, davidb@codeaurora.org, linus.walleij@linaro.org, cesarb@cesarb.net, devicetree@vger.kernel.org, jason@lakedaemon.net, pawel.moll@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, broonie@kernel.org, philip@balister.org, Petr Cvek , akpm@linux-foundation.org, monstr@monstr.eu, Pavel Machek , gregkh@linuxfoundation.org, balbi@ti.com, davem@davemloft.net, robh+dt@kernel.org, rob@landley.net, Josh Cartwright , dinguyen@opensource.altera.com, delicious.quinoa@gmail.com, m.chehab@samsung.com Subject: Re: [PATCH v11 3/4] add FPGA manager core Message-ID: <20150924074953.GI4953@mwanda> References: <1442935271-10375-1-git-send-email-atull@opensource.altera.com> <1442935271-10375-4-git-send-email-atull@opensource.altera.com> <20150922222929.GA26335@jcartwri.amer.corp.natinst.com> <20150923132354.GB31253@amd> <20150923141106.GH4953@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Of course, the maintainer gets the last word regardless of what anyone else thinks. Generally, minimal code is better. Trying to future proof code is a waste of time because you can't predict what will happen in the future. It's way more likely that some pointer you never expected to be NULL will be NULL instead of the few checked at the beginning of a function. Adding useless code uses RAM and makes the function slower. It's a bit confusing for users as well because they will wonder when the NULL check is used. A lot of times this sort of error handling is a bit fake and what I mean is that it looks correct but the system will just crash in a later function. Also especially with a simple NULL dereferences like this theoretical one, it's better to just get the oops. It kills the module but you get a good message in the log and it's normally straight forward to debug. We spent a surprising amount of time discussing useless code. I made someone redo a patch yesterday because they had incomplete error handling for a situation which could never happen. regards, dan carpenter