ASoC: cs-amp-lib: Revert use of __free(kfree) back to normal C cleanup
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Mon, 1 Dec 2025 11:14:29 +0000 (11:14 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 2 Dec 2025 13:37:50 +0000 (13:37 +0000)
commit2b69bee5a2d07bc0583f2a8f17d262ddf7c58466
treee84b24e3370d68742e83f34c3ffdaaf5855fa9ac
parentc5fae31f60a91dbe884ef2789fb3440bb4cddf05
ASoC: cs-amp-lib: Revert use of __free(kfree) back to normal C cleanup

Revert commit 6797540c8b76 ("ASoC: cs-amp-lib: Use __free(kfree) instead
of manual freeing").

Krzysztof Kozlowski pointed out that __free() can be dangerous.
It can introduce new cleanup bugs. These are more subtle and difficult to
spot than a missing goto in traditional cleanup, because they are triggered
by writing regular idiomatic C code instead of using C++ conventions. As
it's regular C style it's more likely to be missed because the code is as
would be expected for C. The traditional goto also more obviously flags
to anyone changing the code in the future that they must be careful about
the cleanup.

We can just revert the change. There was nothing wrong with the original
code and as Krzysztof noted: "it does not make the code simpler."

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 6797540c8b76 ("ASoC: cs-amp-lib: Use __free(kfree) instead of manual freeing")
Link: https://patch.msgid.link/20251201111429.43517-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs-amp-lib.c