lkml.org 
[lkml]   [2016]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2016-09-17 09:59    [W:0.177 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site