From: Mark Brown Date: Wed, 11 Apr 2012 09:19:12 +0000 (+0100) Subject: regulator: Appease smatch in regulator_register() X-Git-Tag: v3.5-rc1~177^2~58^3~32 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=32c8fad438200b523ec44a49b40cb8ffdf715f7c;p=~emulex%2Finfiniband.git regulator: Appease smatch in regulator_register() 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 --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 4bb1f845612..7943fd64988 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -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);