Skip to contentSkip to conversation

ASoC: tlv320adcx140: Fix accessing uninitialized abcx140->dev

PATCH Superseded Camel Guo 2 participants 2 messages Sep 1, 2020

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Camel Guo

author
#0 lore raw

PATCH 1/1 ASoC: tlv320adcx140: Fix accessing uninitialized abcx140->dev

From: Camel Guo <[email protected]>

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

---
 sound/soc/codecs/tlv320adcx140.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/codecs/tlv320adcx140.c +3 -1
index 5cd50d841177..7ae6ec374be3 100644
@@ -980,6 +980,8 @@ static int adcx140_i2c_probe(struct i2c_client *i2c,
 	if (!adcx140)
 		return -ENOMEM;
 
+	adcx140->dev = &i2c->dev;
+
 	adcx140->gpio_reset = devm_gpiod_get_optional(adcx140->dev,
 						      "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(adcx140->gpio_reset))
@@ -1007,7 +1009,7 @@ static int adcx140_i2c_probe(struct i2c_client *i2c,
 			ret);
 		return ret;
 	}
-	adcx140->dev = &i2c->dev;
+
 	i2c_set_clientdata(i2c, adcx140);
 
 	return devm_snd_soc_register_component(&i2c->dev,
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw

Camel

Quoted 4 lines · Camel Guo

From: Camel Guo <[email protected]>

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

s/abc/adc in the subject

and

s/in/In

Also please add a Fixes tag.

Otherwise