ASoC: cs42l56: fix DT probe
Subsystems (4)
PATCH 1/1 ASoC: cs42l56: fix DT probe
From: Arnd Bergmann <[email protected]>
While looking through legacy platform data users, I noticed that this one could never be used with DT based probing as the platform_data structure gets overwritten directly after it is initialized.
There have never been any boards defining the platform_data in the mainline kernel either, so this driver so far only worked with patched kernels.
For the benefit of possible downstream users, fix the DT probe by no longer overwriting the data.
--- sound/soc/codecs/cs42l56.c | 6 ------ 1 file changed, 6 deletions(-)
sound/soc/codecs/cs42l56.c +0 -6
@@ -1191,18 +1191,12 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client)if (pdata) { cs42l56->pdata = *pdata; }else { - pdata =devm_kzalloc (&i2c_client->dev,sizeof (*pdata), -GFP_KERNEL ); -if (!pdata) -return -ENOMEM ; -if (i2c_client->dev.of_node) { ret =cs42l56_handle_of_data (i2c_client, &cs42l56->pdata);if (ret !=0 )return ret; } - cs42l56->pdata = *pdata; }if (cs42l56->pdata.gpio_nreset) {
Signature · 1 line
2.39.0
Mark Brown
maintainerQuoted 10 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
While looking through legacy platform data users, I noticed that this one could never be used with DT based probing as the
platform_datastructure gets overwritten directly after it is initialized.There have never been any boards defining the
platform_datain the mainline kernel either, so this driver so far only worked with patched kernels.
Or there is no mandatory properties/platform data and the defaults are fine for most systems (which is a common case).
Charles Keepax
Acked-byQuoted 8 lines · Mark Brown
Quoted 7 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
While looking through legacy platform data users, I noticed that this one could never be used with DT based probing as the
platform_datastructure gets overwritten directly after it is initialized.
Quoted 6 lines
Quoted 3 lines
There have never been any boards defining the
platform_datain the mainline kernel either, so this driver so far only worked with patched kernels.Or there is no mandatory properties/platform data and the defaults are fine for most systems (which is a common case).
I think Arnd is right here, the driver appears to allocate a big block of zeros and then blat that over the top of everything it read from device tree. So you can literally never use any of the DT properties as it stands.
Thanks,
Charles
Mark Brown
maintainerQuoted 9 lines · Charles Keepax
Quoted 2 lines · Mark Brown
Or there is no mandatory properties/platform data and the defaults are fine for most systems (which is a common case).
I think Arnd is right here, the driver appears to allocate a big block of zeros and then blat that over the top of everything it read from device tree. So you can literally never use any of the DT properties as it stands.
Oh, the fix is fixing a real issue - it's the claim in the commit log that the driver could never have worked that's not obviously correct.