Re: [PATCH] regulator: remove unnecessary code

From: Mark Brown
Date: Tue Feb 21 2017 - 12:41:20 EST


On Mon, Feb 20, 2017 at 11:17:36PM -0600, Gustavo A. R. Silva wrote:
> The name of an array used by itself will always return the array's address.
> So it makes no sense to evaluate it, since the test will always evaluate as
> true.

> - if (pdata && pdata->regulators) {
> + if (pdata) {

This isn't actually helping anything, it just makes the code potentially
less robust if someone changes regulators to be allocated separately.
There's no cost to having the check in the code, the compiler should
notice if it's always true.

Attachment: signature.asc
Description: PGP signature