Skip to content

Commit 30facd4

Browse files
committed
ASoC: wm8350: Don't use locally allocated codec struct
The core allocates the live copies, we shouldn't try to duplicate it and were buggy trying to do so as we were using uninitialised data for the control data. Signed-off-by: Mark Brown <[email protected]>
1 parent e875c1e commit 30facd4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

sound/soc/codecs/wm8350.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct wm8350_jack_data {
6060
};
6161

6262
struct wm8350_data {
63-
struct snd_soc_codec codec;
63+
struct wm8350 *wm8350;
6464
struct wm8350_output out1;
6565
struct wm8350_output out2;
6666
struct wm8350_jack_data hpl;
@@ -1309,7 +1309,7 @@ static void wm8350_hp_work(struct wm8350_data *priv,
13091309
struct wm8350_jack_data *jack,
13101310
u16 mask)
13111311
{
1312-
struct wm8350 *wm8350 = priv->codec.control_data;
1312+
struct wm8350 *wm8350 = priv->wm8350;
13131313
u16 reg;
13141314
int report;
13151315

@@ -1342,7 +1342,7 @@ static void wm8350_hpr_work(struct work_struct *work)
13421342
static irqreturn_t wm8350_hp_jack_handler(int irq, void *data)
13431343
{
13441344
struct wm8350_data *priv = data;
1345-
struct wm8350 *wm8350 = priv->codec.control_data;
1345+
struct wm8350 *wm8350 = priv->wm8350;
13461346
struct wm8350_jack_data *jack = NULL;
13471347

13481348
switch (irq - wm8350->irq_base) {
@@ -1427,7 +1427,7 @@ EXPORT_SYMBOL_GPL(wm8350_hp_jack_detect);
14271427
static irqreturn_t wm8350_mic_handler(int irq, void *data)
14281428
{
14291429
struct wm8350_data *priv = data;
1430-
struct wm8350 *wm8350 = priv->codec.control_data;
1430+
struct wm8350 *wm8350 = priv->wm8350;
14311431
u16 reg;
14321432
int report = 0;
14331433

@@ -1536,6 +1536,8 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
15361536
return -ENOMEM;
15371537
snd_soc_codec_set_drvdata(codec, priv);
15381538

1539+
priv->wm8350 = wm8350;
1540+
15391541
for (i = 0; i < ARRAY_SIZE(supply_names); i++)
15401542
priv->supplies[i].supply = supply_names[i];
15411543

@@ -1544,7 +1546,6 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
15441546
if (ret != 0)
15451547
return ret;
15461548

1547-
wm8350->codec.codec = codec;
15481549
codec->control_data = wm8350;
15491550

15501551
/* Put the codec into reset if it wasn't already */

0 commit comments

Comments
 (0)