Commit 4e65bda
ASoC: wcd934x: fix error handling in wcd934x_codec_parse_data()
wcd934x_codec_parse_data() contains a device reference count leak in
of_slim_get_device() where device_find_child() increases the reference
count of the device but this reference is not properly decreased in
the success path. Add put_device() in wcd934x_codec_parse_data() and
add devm_add_action_or_reset() in the probe function, which ensures
that the reference count of the device is correctly managed.
Memory leak in regmap_init_slimbus() as the allocated regmap is not
released when the device is removed. Using devm_regmap_init_slimbus()
instead of regmap_init_slimbus() to ensure automatic regmap cleanup on
device removal.
Calling path: of_slim_get_device() -> of_find_slim_device() ->
device_find_child(). As comment of device_find_child() says, 'NOTE:
you will need to drop the reference with put_device() after use.'.
Found by code review.
Cc: stable@vger.kernel.org
Fixes: a61f3b4 ("ASoC: wcd934x: add support to wcd9340/wcd9341 codec")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/20250923065212.26660-1-make24@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>1 parent 87cab86 commit 4e65bda
1 file changed
+15
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5831 | 5831 | | |
5832 | 5832 | | |
5833 | 5833 | | |
| 5834 | + | |
| 5835 | + | |
| 5836 | + | |
| 5837 | + | |
| 5838 | + | |
| 5839 | + | |
| 5840 | + | |
5834 | 5841 | | |
5835 | 5842 | | |
5836 | 5843 | | |
| |||
5847 | 5854 | | |
5848 | 5855 | | |
5849 | 5856 | | |
5850 | | - | |
| 5857 | + | |
5851 | 5858 | | |
5852 | | - | |
| 5859 | + | |
| 5860 | + | |
5853 | 5861 | | |
5854 | 5862 | | |
| 5863 | + | |
5855 | 5864 | | |
5856 | 5865 | | |
5857 | 5866 | | |
| |||
5893 | 5902 | | |
5894 | 5903 | | |
5895 | 5904 | | |
| 5905 | + | |
| 5906 | + | |
| 5907 | + | |
| 5908 | + | |
5896 | 5909 | | |
5897 | 5910 | | |
5898 | 5911 | | |
| |||
0 commit comments