aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2012-08-21 02:16:23 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-09-15 18:33:09 -0400
commitb186b12487efc80c44f2f0d26cc26eb249cf1524 (patch)
treee6ff10b5e12ffbbfdc4abaf88e4ad0e2a25146ef
parentd51f42d2c5b7e11b47876b8b5c53f0ac317fef24 (diff)
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: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reported-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/extcon/extcon-max77693.c19
-rw-r--r--drivers/mfd/max77693.c14
2 files changed, 26 insertions, 7 deletions
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 920a609b2c35..38f9e52f358b 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -669,13 +669,18 @@ static int __devinit max77693_muic_probe(struct platform_device *pdev)
669 } 669 }
670 info->dev = &pdev->dev; 670 info->dev = &pdev->dev;
671 info->max77693 = max77693; 671 info->max77693 = max77693;
672 info->max77693->regmap_muic = regmap_init_i2c(info->max77693->muic, 672 if (info->max77693->regmap_muic)
673 &max77693_muic_regmap_config); 673 dev_dbg(&pdev->dev, "allocate register map\n");
674 if (IS_ERR(info->max77693->regmap_muic)) { 674 else {
675 ret = PTR_ERR(info->max77693->regmap_muic); 675 info->max77693->regmap_muic = devm_regmap_init_i2c(
676 dev_err(max77693->dev, 676 info->max77693->muic,
677 "failed to allocate register map: %d\n", ret); 677 &max77693_muic_regmap_config);
678 goto err_regmap; 678 if (IS_ERR(info->max77693->regmap_muic)) {
679 ret = PTR_ERR(info->max77693->regmap_muic);
680 dev_err(max77693->dev,
681 "failed to allocate register map: %d\n", ret);
682 goto err_regmap;
683 }
679 } 684 }
680 platform_set_drvdata(pdev, info); 685 platform_set_drvdata(pdev, info);
681 mutex_init(&info->mutex); 686 mutex_init(&info->mutex);
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index 4fdd03d28539..cc5155e20494 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -152,6 +152,20 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
152 max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC); 152 max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC);
153 i2c_set_clientdata(max77693->haptic, max77693); 153 i2c_set_clientdata(max77693->haptic, max77693);
154 154
155 /*
156 * Initialize register map for MUIC device because use regmap-muic
157 * instance of MUIC device when irq of max77693 is initialized
158 * before call max77693-muic probe() function.
159 */
160 max77693->regmap_muic = devm_regmap_init_i2c(max77693->muic,
161 &max77693_regmap_config);
162 if (IS_ERR(max77693->regmap_muic)) {
163 ret = PTR_ERR(max77693->regmap_muic);
164 dev_err(max77693->dev,
165 "failed to allocate register map: %d\n", ret);
166 goto err_regmap;
167 }
168
155 ret = max77693_irq_init(max77693); 169 ret = max77693_irq_init(max77693);
156 if (ret < 0) 170 if (ret < 0)
157 goto err_irq; 171 goto err_irq;