Commit 2569231d authored by Camel Guo's avatar Camel Guo Committed by Mark Brown

ASoC: tlv320adcx140: Fix accessing uninitialized adcx140->dev

In adcx140_i2c_probe, adcx140->dev is accessed before its
initialization. This commit fixes this bug.

Fixes: 689c7655 ("ASoC: tlv320adcx140: Add the tlv320adcx140 codec driver family")
Acked-by: default avatarDan Murphy <dmurphy@ti.com>
Signed-off-by: default avatarCamel Guo <camel.guo@axis.com>
Link: https://lore.kernel.org/r/20200901135736.32036-1-camel.guo@axis.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f5a2cda4
...@@ -980,6 +980,8 @@ static int adcx140_i2c_probe(struct i2c_client *i2c, ...@@ -980,6 +980,8 @@ static int adcx140_i2c_probe(struct i2c_client *i2c,
if (!adcx140) if (!adcx140)
return -ENOMEM; return -ENOMEM;
adcx140->dev = &i2c->dev;
adcx140->gpio_reset = devm_gpiod_get_optional(adcx140->dev, adcx140->gpio_reset = devm_gpiod_get_optional(adcx140->dev,
"reset", GPIOD_OUT_LOW); "reset", GPIOD_OUT_LOW);
if (IS_ERR(adcx140->gpio_reset)) if (IS_ERR(adcx140->gpio_reset))
...@@ -1007,7 +1009,7 @@ static int adcx140_i2c_probe(struct i2c_client *i2c, ...@@ -1007,7 +1009,7 @@ static int adcx140_i2c_probe(struct i2c_client *i2c,
ret); ret);
return ret; return ret;
} }
adcx140->dev = &i2c->dev;
i2c_set_clientdata(i2c, adcx140); i2c_set_clientdata(i2c, adcx140);
return devm_snd_soc_register_component(&i2c->dev, return devm_snd_soc_register_component(&i2c->dev,
......
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