mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-18 02:04:05 +08:00
mfd: max77686: Init max77686->dev before using it
Current code uses max77686->dev in the dev_err call before setting it to &i2c->dev. Fix it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
89d9b1c993
commit
136d982eca
@ -93,15 +93,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
|
||||
if (max77686 == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
max77686->regmap = regmap_init_i2c(i2c, &max77686_regmap_config);
|
||||
if (IS_ERR(max77686->regmap)) {
|
||||
ret = PTR_ERR(max77686->regmap);
|
||||
dev_err(max77686->dev, "Failed to allocate register map: %d\n",
|
||||
ret);
|
||||
kfree(max77686);
|
||||
return ret;
|
||||
}
|
||||
|
||||
i2c_set_clientdata(i2c, max77686);
|
||||
max77686->dev = &i2c->dev;
|
||||
max77686->i2c = i2c;
|
||||
@ -111,6 +102,15 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
|
||||
max77686->irq_gpio = pdata->irq_gpio;
|
||||
max77686->irq = i2c->irq;
|
||||
|
||||
max77686->regmap = regmap_init_i2c(i2c, &max77686_regmap_config);
|
||||
if (IS_ERR(max77686->regmap)) {
|
||||
ret = PTR_ERR(max77686->regmap);
|
||||
dev_err(max77686->dev, "Failed to allocate register map: %d\n",
|
||||
ret);
|
||||
kfree(max77686);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (regmap_read(max77686->regmap,
|
||||
MAX77686_REG_DEVICE_ID, &data) < 0) {
|
||||
dev_err(max77686->dev,
|
||||
|
Loading…
Reference in New Issue
Block a user