[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150609070347.GE2982@x1>
Date: Tue, 9 Jun 2015 08:03:47 +0100
From: Lee Jones <lee.jones@...aro.org>
To: Mark Brown <broonie@...nel.org>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
kernel@...inux.com, lgirdwood@...il.com
Subject: Re: [PATCH 5/8] regulator: pwm-regulator: Don't assign structure
attributes right away
On Mon, 08 Jun 2015, Mark Brown wrote:
> On Fri, Jun 05, 2015 at 07:42:48PM +0100, Lee Jones wrote:
> > Perhaps this is just personal preference, but ...
>
> Possibly...
>
> > Prevents this kind of nonsense:
>
> > this->is->just.silly = fetch_silly_value(&pointer);
> > if (!this->is->just.silly) {
> > printk("Silly value failed: %d\n", this->is->just.silly);
> > return this->is->just.silly;
> > }
>
> But we don't have any of that code? Well, one if statement where we
> check config.init_data but that's it. A temporary does help with things
> like the above but we're not doing that in this driver are we?
Admittedly this is an extreme example, but I do consider:
init_data = of_get_regulator_init_data(<blah>);
if (init_data)
return -ENOMEM;
... neater than:
config.init_data = of_get_regulator_init_data(<blah>);
if (!config.init_data)
return -ENOMEM;
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists