diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2025-03-21 17:35:25 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2025-03-26 16:30:44 +0300 |
commit | 012a6efcc805308b1d90a1056ba963eb08858645 (patch) | |
tree | 4fa68e3ff975f92de119da93f21bc2e439d279b8 /lib/string_helpers.c | |
parent | 2593f7e0dc93a898a84220b3fb180d86f1ca8c60 (diff) | |
download | linux-012a6efcc805308b1d90a1056ba963eb08858645.tar.xz |
ASoC: sma1307: Fix error handling in sma1307_setting_loaded()
There are a couple bugs in this code:
1) The cleanup code calls kfree(sma1307->set.header) and
kfree(sma1307->set.def) but those functions were allocated using
devm_kzalloc(). It results in a double free. Delete all these
kfree() calls.
2) A missing call to kfree(data) if the checksum was wrong on this error
path:
if ((sma1307->set.checksum >> 8) != SMA1307_SETTING_CHECKSUM) {
Since the "data" pointer is supposed to be freed on every return, I
changed that to use the __free(kfree) cleanup attribute.
Fixes: 0ec6bd16705f ("ASoC: sma1307: Add NULL check in sma1307_setting_loaded()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/8d32dd96-1404-4373-9b6c-c612a9c18c4c@stanley.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'lib/string_helpers.c')
0 files changed, 0 insertions, 0 deletions