ASoC: Make soc_component_read() returning an error code again
authorTakashi Iwai <tiwai@suse.de>
Mon, 10 Aug 2020 13:46:31 +0000 (15:46 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 11 Aug 2020 13:05:46 +0000 (14:05 +0100)
commitefc913c8fb88728626759735e1b09370a6813180
treede0fb491ca7ebe557c3a34b4532650acc352a63a
parentea7dc097826b06a9746a2e74c2d6e78d35c98088
ASoC: Make soc_component_read() returning an error code again

Along with the recent unification of snd_soc_component_read*()
functions, the behavior of snd_soc_component_read() was changed
slightly; namely it returns the register read value directly, and even
if an error happens, it returns zero (but it prints an error
message).  That said, the caller side can't know whether it's an error
or not any longer.

Ideally this shouldn't matter much, but in practice this seems causing
a regression, as John reported.  And, grepping the tree revealed that
there are still plenty of callers that do check the error code, so
we'll need to deal with them in anyway.

As a quick band-aid over the regression, this patch changes the return
value of snd_soc_component_read() again to the negative error code.
It can't work, obviously, for 32bit register values, but it should be
enough for the known regressions, so far.

Fixes: cf6e26c71bfd ("ASoC: soc-component: merge snd_soc_component_read() and snd_soc_component_read32()")
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200810134631.19742-1-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-component.c