[PATCH 00/10] Tidy up device ID reading on legacy Cirrus parts

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Mon May 10 16:59:55 CEST 2021



On 5/10/21 8:13 AM, Charles Keepax wrote:
> Pierre requested I have a look at some cppcheck warnings in the cs42l42
> driver, since it is reassigning the ret variable without ever checking
> the result.  Looking a bit more broadly this happens in quite a few
> legacy Cirrus parts, as they all use the same process to read the ID,
> factor out a small helper so they can all share the same code. Whilst
> in there fix up a couple of other trivial error path issues as well.
> 
> Thanks,
> Charles
> 
> Charles Keepax (10):
>    ASoC: cirrus: Add helper function for reading the device ID
>    ASoC: cs35l32: Minor error paths fixups
>    ASoC: cs35l33: Minor error paths fixups
>    ASoC: cs35l34:  Minor error paths fixups
>    ASoC: cs35l35:  Minor error paths fixups
>    ASoC: cs35l35: Correct errata handling
>    ASoC: cs42l42:  Minor error paths fixups
>    ASoC: cs42l73:  Minor error paths fixups
>    ASoC: cs43130:  Minor error paths fixups
>    ASoC: cs53l30:  Minor error paths fixups

Sounds all good to me, just wondering if while you're at it you can fix 
the remaining minor issues? Thanks!

cppcheck --platform=unix64 --force --max-configs=1024 --inconclusive 
--enable=all --suppress=variableScope --suppress=shiftTooManyBitsSigned 
--suppress=arithOperationsOnVoidPointer --suppress=bitwiseOnBoolean 
sound/soc/codecs/cs*.c

sound/soc/codecs/cs35l36.c:1159:10: style: Variable 'ret' is assigned a 
value that is never used. [unreadVariable]
  int ret = 0;
          ^
sound/soc/codecs/cs4265.c:619:6: style: Variable 'ret' is reassigned a 
value before the old one has been used. [redundantAssignment]
  ret = devm_snd_soc_register_component(&i2c_client->dev,
      ^
sound/soc/codecs/cs4265.c:604:6: note: ret is assigned
  ret = regmap_read(cs4265->regmap, CS4265_CHIP_ID, &reg);
      ^
sound/soc/codecs/cs4265.c:619:6: note: ret is overwritten
  ret = devm_snd_soc_register_component(&i2c_client->dev,
      ^
sound/soc/codecs/cs42l52.c:1202:6: style: Variable 'ret' is reassigned a 
value before the old one has been used. [redundantAssignment]
  ret =  devm_snd_soc_register_component(&i2c_client->dev,
      ^
sound/soc/codecs/cs42l52.c:1165:6: note: ret is assigned
  ret = regmap_read(cs42l52->regmap, CS42L52_CHIP, &reg);
      ^
sound/soc/codecs/cs42l52.c:1202:6: note: ret is overwritten
  ret =  devm_snd_soc_register_component(&i2c_client->dev,
      ^


> 
>   sound/soc/codecs/cirrus_legacy.h | 21 +++++++++++++++++++++
>   sound/soc/codecs/cs35l32.c       | 34 ++++++++++++++++++----------------
>   sound/soc/codecs/cs35l33.c       | 15 +++++++++------
>   sound/soc/codecs/cs35l34.c       | 39 ++++++++++++++++++++++-----------------
>   sound/soc/codecs/cs35l35.c       | 21 ++++++++++-----------
>   sound/soc/codecs/cs35l35.h       |  1 +
>   sound/soc/codecs/cs42l42.c       | 18 ++++++++----------
>   sound/soc/codecs/cs42l73.c       | 30 +++++++++++++++++-------------
>   sound/soc/codecs/cs43130.c       | 31 +++++++++++++++++++------------
>   sound/soc/codecs/cs53l30.c       | 22 +++++++++++-----------
>   10 files changed, 136 insertions(+), 96 deletions(-)
>   create mode 100644 sound/soc/codecs/cirrus_legacy.h
> 


More information about the Alsa-devel mailing list