From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751638AbcILXvz (ORCPT ); Mon, 12 Sep 2016 19:51:55 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:34812 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750747AbcILXvy (ORCPT ); Mon, 12 Sep 2016 19:51:54 -0400 Date: Tue, 13 Sep 2016 00:51:42 +0100 From: Mark Brown To: Colin King Cc: Support Opensource , Liam Girdwood , linux-kernel@vger.kernel.org Message-ID: <20160912235142.GN27946@sirena.org.uk> References: <20160908100736.19046-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0oEQci8Wf3TZ4Qnh" Content-Disposition: inline In-Reply-To: <20160908100736.19046-1-colin.king@canonical.com> X-Cookie: Question authority. User-Agent: Mutt/1.6.0 (2016-04-01) X-SA-Exim-Connect-IP: 2a01:348:6:8808:fab::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [PATCH] regulator: da9052: remove null pointer check on array pdata->regulators X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0oEQci8Wf3TZ4Qnh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Sep 08, 2016 at 11:07:36AM +0100, Colin King wrote: > pdata->regulators is an array of DA9052_MAX_REGULATORS struct > regulator_init_data pointers hence cannot be null, so the null pointer > check on pdata->regulators is redundant. Remove it. > - if (pdata && pdata->regulators) { > + if (pdata) { What is the benefit of this change? Due to the way C handles arrays and pointers one can't immediately tell without opening up the header file if regulators is a pointer to an array or an embedded array so it's more work to read and since this is the probe path it's unlikely to be a meaningful speed improvement even if the compiler doesn't figure it out at build time. --0oEQci8Wf3TZ4Qnh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJX1z+MAAoJECTWi3JdVIfQrhIH/jbdSG3rIOjU60oknzQuo1xv Vdp0/Sere8rztzRJvf1osnLdPxQ2HrfLNnO1OlajQ1Ev2SAUgUw+/MLfcAvm0XTj zcNney6AUuOps05y82m1TU736dtJr/mCnZNDnvgBBV9tqmcwXcDvA0NUHpA3U1B2 G80VsxCk8z/cUP1igo1+4Xsk400I3/6L//uywI7AM2GJb9zyhISpxPQdotSkx8/b w1vCkcWMz5K4Ea8ZpAPPB5AwfRh2tZnA8+iTyo4YndMlNUeCA0IKUqm4CI75uMeR RXjYlqyk+KnxPjEYB60jMA1alTvnPwV2dk2J/bH29spgMpPxq9+yPe91m1YK9vs= =6fi/ -----END PGP SIGNATURE----- --0oEQci8Wf3TZ4Qnh--