[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160912235142.GN27946@sirena.org.uk>
Date: Tue, 13 Sep 2016 00:51:42 +0100
From: Mark Brown <broonie@...nel.org>
To: Colin King <colin.king@...onical.com>
Cc: Support Opensource <support.opensource@...semi.com>,
Liam Girdwood <lgirdwood@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] regulator: da9052: remove null pointer check on array
pdata->regulators
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.
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists