Skip to content

Commit

Permalink
regulator: Appease smatch in regulator_register()
Browse files Browse the repository at this point in the history
We don't support missing configs at all so segfaulting isn't that bad
but since we've got checks in the code move the dereference after them.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Mark Brown committed Apr 11, 2012
1 parent 9eb0c42 commit 32c8fad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2833,13 +2833,15 @@ regulator_register(const struct regulator_desc *regulator_desc,
const struct regulator_init_data *init_data;
static atomic_t regulator_no = ATOMIC_INIT(0);
struct regulator_dev *rdev;
struct device *dev = config->dev;
struct device *dev;
int ret, i;
const char *supply = NULL;

if (regulator_desc == NULL || config == NULL)
return ERR_PTR(-EINVAL);

dev = config->dev;

if (regulator_desc->name == NULL || regulator_desc->ops == NULL)
return ERR_PTR(-EINVAL);

Expand Down

0 comments on commit 32c8fad

Please sign in to comment.