Commit 887780b8 authored by Chanwoo Choi's avatar Chanwoo Choi Committed by Samuel Ortiz

mfd: MAX77693: Fix NULL pointer error when initializing irqs

This patch initialize register map of MUIC device because mfd driver
of Maxim MAX77693 use regmap-muic instance of MUIC device when irqs of
Maxim MAX77693 is initialized before call max77693-muic probe() function.
Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: default avatarMyungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Reported-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent f84e9954
...@@ -669,13 +669,18 @@ static int __devinit max77693_muic_probe(struct platform_device *pdev) ...@@ -669,13 +669,18 @@ static int __devinit max77693_muic_probe(struct platform_device *pdev)
} }
info->dev = &pdev->dev; info->dev = &pdev->dev;
info->max77693 = max77693; info->max77693 = max77693;
info->max77693->regmap_muic = regmap_init_i2c(info->max77693->muic, if (info->max77693->regmap_muic)
&max77693_muic_regmap_config); dev_dbg(&pdev->dev, "allocate register map\n");
if (IS_ERR(info->max77693->regmap_muic)) { else {
ret = PTR_ERR(info->max77693->regmap_muic); info->max77693->regmap_muic = devm_regmap_init_i2c(
dev_err(max77693->dev, info->max77693->muic,
"failed to allocate register map: %d\n", ret); &max77693_muic_regmap_config);
goto err_regmap; if (IS_ERR(info->max77693->regmap_muic)) {
ret = PTR_ERR(info->max77693->regmap_muic);
dev_err(max77693->dev,
"failed to allocate register map: %d\n", ret);
goto err_regmap;
}
} }
platform_set_drvdata(pdev, info); platform_set_drvdata(pdev, info);
mutex_init(&info->mutex); mutex_init(&info->mutex);
......
...@@ -152,6 +152,20 @@ static int max77693_i2c_probe(struct i2c_client *i2c, ...@@ -152,6 +152,20 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC); max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC);
i2c_set_clientdata(max77693->haptic, max77693); i2c_set_clientdata(max77693->haptic, max77693);
/*
* Initialize register map for MUIC device because use regmap-muic
* instance of MUIC device when irq of max77693 is initialized
* before call max77693-muic probe() function.
*/
max77693->regmap_muic = devm_regmap_init_i2c(max77693->muic,
&max77693_regmap_config);
if (IS_ERR(max77693->regmap_muic)) {
ret = PTR_ERR(max77693->regmap_muic);
dev_err(max77693->dev,
"failed to allocate register map: %d\n", ret);
goto err_regmap;
}
ret = max77693_irq_init(max77693); ret = max77693_irq_init(max77693);
if (ret < 0) if (ret < 0)
goto err_irq; goto err_irq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment