[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200901125123.25886-1-camel.guo@axis.com>
Date: Tue, 1 Sep 2020 14:51:22 +0200
From: Camel Guo <camel.guo@...s.com>
To: <lgirdwood@...il.com>, <broonie@...nel.org>, <perex@...ex.cz>,
<tiwai@...e.com>, <dmurphy@...com>
CC: <alsa-devel@...a-project.org>, <linux-kernel@...r.kernel.org>,
<kernel@...s.com>, Camel Guo <camelg@...s.com>,
Camel Guo <camel.guo@...s.com>
Subject: [PATCH v2] ASoC: tlv320adcx140: Fix accessing uninitialized adcx140->dev
From: Camel Guo <camelg@...s.com>
In adcx140_i2c_probe, adcx140->dev is accessed before its
initialization. This commit fixes this bug.
Signed-off-by: Camel Guo <camel.guo@...s.com>
---
sound/soc/codecs/tlv320adcx140.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c
index 5cd50d841177..7ae6ec374be3 100644
--- a/sound/soc/codecs/tlv320adcx140.c
+++ b/sound/soc/codecs/tlv320adcx140.c
@@ -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,
--
2.20.1
Powered by blists - more mailing lists