Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750854AbbGBLT6 (ORCPT ); Thu, 2 Jul 2015 07:19:58 -0400 Received: from opensource.wolfsonmicro.com ([80.75.67.52]:49722 "EHLO opensource.wolfsonmicro.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753299AbbGBLTv (ORCPT ); Thu, 2 Jul 2015 07:19:51 -0400 Date: Thu, 2 Jul 2015 12:19:50 +0100 From: Charles Keepax To: Mark Brown Cc: Maninder Singh , lgirdwood@gmail.com, patches@opensource.wolfsonmicro.com, linux-kernel@vger.kernel.org, pankaj.m@samsung.com Subject: Re: [PATCH v2] regulator: wm831x-dcdc: Use pointer after NULL check Message-ID: <20150702111950.GD16517@opensource.wolfsonmicro.com> References: <1435823829-3174-1-git-send-email-maninder1.s@samsung.com> <20150702101849.GB16517@opensource.wolfsonmicro.com> <20150702111456.GY11162@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150702111456.GY11162@sirena.org.uk> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1072 Lines: 26 On Thu, Jul 02, 2015 at 12:14:56PM +0100, Mark Brown wrote: > On Thu, Jul 02, 2015 at 11:18:49AM +0100, Charles Keepax wrote: > > On Thu, Jul 02, 2015 at 01:27:09PM +0530, Maninder Singh wrote: > > > pdata is used before NULL check, so it looks misleading. > > > The patch basically looks fine, but it feels a bit like needless > > churn. The current code is perfectly correct and feels clear > > enough to me. > > It's a bug - either the validation shouldn't be there or it needs to be > before the use otherwise it does nothing. ARRAY_SIZE being implemented with sizeof's means that no actual dereference takes place. But if we have multiple people thinking this looks buggy then I guess the code probably isn't clear enough at the moment. Acked-by: Charles Keepax Thanks, Charles -- 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/