aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorNicolin Chen <b42378@freescale.com>2013-10-29 05:06:27 -0400
committerMark Brown <broonie@linaro.org>2013-10-29 12:33:51 -0400
commitb5ef3f2a8074af7aef9a32f4535c57f986364a60 (patch)
tree40fbe74c16387f8e2ce8426775d095c8d5ba76a4 /sound/soc
parent78b78f5c019e5c68c88afad4b0d3070becde939e (diff)
ASoC: wm8962: Fix null pointer pdata access in I2C probe()
When using DT binding to pass private data, there would be Kernel panic occuring due to NULL pointer access in wm8962_i2c_probe(). Thus fix it. Signed-off-by: Nicolin Chen <b42378@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/wm8962.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 2bf9ee7c5407..7dd79c4efc13 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3616,28 +3616,28 @@ static int wm8962_i2c_probe(struct i2c_client *i2c,
3616 0); 3616 0);
3617 3617
3618 /* Apply static configuration for GPIOs */ 3618 /* Apply static configuration for GPIOs */
3619 for (i = 0; i < ARRAY_SIZE(pdata->gpio_init); i++) 3619 for (i = 0; i < ARRAY_SIZE(wm8962->pdata.gpio_init); i++)
3620 if (pdata->gpio_init[i]) { 3620 if (wm8962->pdata.gpio_init[i]) {
3621 wm8962_set_gpio_mode(wm8962, i + 1); 3621 wm8962_set_gpio_mode(wm8962, i + 1);
3622 regmap_write(wm8962->regmap, 0x200 + i, 3622 regmap_write(wm8962->regmap, 0x200 + i,
3623 pdata->gpio_init[i] & 0xffff); 3623 wm8962->pdata.gpio_init[i] & 0xffff);
3624 } 3624 }
3625 3625
3626 3626
3627 /* Put the speakers into mono mode? */ 3627 /* Put the speakers into mono mode? */
3628 if (pdata->spk_mono) 3628 if (wm8962->pdata.spk_mono)
3629 regmap_update_bits(wm8962->regmap, WM8962_CLASS_D_CONTROL_2, 3629 regmap_update_bits(wm8962->regmap, WM8962_CLASS_D_CONTROL_2,
3630 WM8962_SPK_MONO_MASK, WM8962_SPK_MONO); 3630 WM8962_SPK_MONO_MASK, WM8962_SPK_MONO);
3631 3631
3632 /* Micbias setup, detection enable and detection 3632 /* Micbias setup, detection enable and detection
3633 * threasholds. */ 3633 * threasholds. */
3634 if (pdata->mic_cfg) 3634 if (wm8962->pdata.mic_cfg)
3635 regmap_update_bits(wm8962->regmap, WM8962_ADDITIONAL_CONTROL_4, 3635 regmap_update_bits(wm8962->regmap, WM8962_ADDITIONAL_CONTROL_4,
3636 WM8962_MICDET_ENA | 3636 WM8962_MICDET_ENA |
3637 WM8962_MICDET_THR_MASK | 3637 WM8962_MICDET_THR_MASK |
3638 WM8962_MICSHORT_THR_MASK | 3638 WM8962_MICSHORT_THR_MASK |
3639 WM8962_MICBIAS_LVL, 3639 WM8962_MICBIAS_LVL,
3640 pdata->mic_cfg); 3640 wm8962->pdata.mic_cfg);
3641 3641
3642 /* Latch volume update bits */ 3642 /* Latch volume update bits */
3643 regmap_update_bits(wm8962->regmap, WM8962_LEFT_INPUT_VOLUME, 3643 regmap_update_bits(wm8962->regmap, WM8962_LEFT_INPUT_VOLUME,
@@ -3682,7 +3682,7 @@ static int wm8962_i2c_probe(struct i2c_client *i2c,
3682 } 3682 }
3683 3683
3684 if (wm8962->irq) { 3684 if (wm8962->irq) {
3685 if (pdata->irq_active_low) { 3685 if (wm8962->pdata.irq_active_low) {
3686 trigger = IRQF_TRIGGER_LOW; 3686 trigger = IRQF_TRIGGER_LOW;
3687 irq_pol = WM8962_IRQ_POL; 3687 irq_pol = WM8962_IRQ_POL;
3688 } else { 3688 } else {