OSDN Git Service

regulator: pwm-regulator: Don't assign structure attributes right away
authorLee Jones <lee.jones@linaro.org>
Tue, 7 Jul 2015 15:06:53 +0000 (16:06 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 7 Jul 2015 17:58:28 +0000 (18:58 +0100)
commit5ad2cb14f5b8f3cb3d8688115037751b1ff45455
tree5fd15d4d094d8e79e4e1903765effd7ea97e59b8
parentcae897dec26a9d81dcb5182b13b08450f38d6bde
regulator: pwm-regulator: Don't assign structure attributes right away

Perhaps this is just personal preference, but ...

This patch introduces a new local variable to receive and test regulator
initialisation data.  It simplifies and cleans up the code making it
that little bit easier to read and maintain.  The local value is assigned
to the structure attribute when all the others are.  This is the way we
usually do things.

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;
}

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/pwm-regulator.c