regulator: core: Don't dereference config->dev before NULL checking for config
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Axel Lin <[email protected]>
--- drivers/regulator/core.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/regulator/core.c +2 -1
@@ -2853,7 +2853,7 @@ 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 ;
@@ -2883,6 +2883,7 @@ regulator_register(const struct regulator_desc *regulator_desc,return ERR_PTR (-EINVAL ); } + dev = config->dev; init_data = config->init_data; rdev =kzalloc (sizeof (struct regulator_dev ),GFP_KERNEL );
Signature · 1 line
1.7.5.4
Quoted 2 lines · Axel Lin
Reported-by Dan Carpenter <[email protected]>Signed-off-by Axel Lin <[email protected]>
Already fixed.