]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ASoC: cs-amp-lib: Replace __free(kfree) with normal kfree() cleanup
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Mon, 1 Dec 2025 12:39:06 +0000 (12:39 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 17 Dec 2025 12:04:37 +0000 (12:04 +0000)
commit9a123f222e1889d020d873aa6e0799098d22cdb1
tree7d237db537c974cb7053d19b24d5fbaa68476177
parent22937af75abb3260c2d563739181f4b61ddac2c1
ASoC: cs-amp-lib: Replace __free(kfree) with normal kfree() cleanup

Replace the use of __free(kfree) in _cs_amp_set_efi_calibration_data()
with normal kfree() at the end of the function.

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.

Arguably the traditional approach is more readable, and it avoids the
manipulation of __free() pointers when the buffer is reallocated for
resizing.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20251201123906.86876-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs-amp-lib.c