summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-03-02 16:35:13 +0300
committerMark Brown <broonie@kernel.org>2026-03-02 16:35:13 +0300
commita8fd392f6e3ad33b87dfdb6d438f05c5bc29d2e6 (patch)
tree8fb770e84a5b15c80caab3c507909d116b03889d
parentca5355db6330ccd1a02bb382b793d0a2027c7fd3 (diff)
parent1696fad8b259a2d46e51cd6e17e4bcdbe02279fa (diff)
downloadlinux-a8fd392f6e3ad33b87dfdb6d438f05c5bc29d2e6.tar.xz
ASoC: sti: regmap_field usage improvements
Merge series from Sander Vanheule <sander@svanheule.net>: uni_player_parse_dt_audio_glue() allocates two regmap_field objects on the device's regmap. However, error codes from these allocations are not propagated correctly and the resources will leak on device removal. These issues were found while looking for users of regmap_field_alloc(), to assess the impact of adding a cleanup helper for regmap_field. It appears this driver is the only (remaining) in-tree user of this allocator. Since the resources are long-lived, it may as well switch to devm_regmap_field_alloc(). As I don't have access to this hardware, these patches were only compile tested on a UM build.
-rw-r--r--sound/soc/sti/uniperif_player.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/soc/sti/uniperif_player.c b/sound/soc/sti/uniperif_player.c
index 6d1ce030963c..45d35b887e4e 100644
--- a/sound/soc/sti/uniperif_player.c
+++ b/sound/soc/sti/uniperif_player.c
@@ -1028,8 +1028,13 @@ static int uni_player_parse_dt_audio_glue(struct platform_device *pdev,
return PTR_ERR(regmap);
}
- player->clk_sel = regmap_field_alloc(regmap, regfield[0]);
- player->valid_sel = regmap_field_alloc(regmap, regfield[1]);
+ player->clk_sel = devm_regmap_field_alloc(&pdev->dev, regmap, regfield[0]);
+ if (IS_ERR(player->clk_sel))
+ return PTR_ERR(player->clk_sel);
+
+ player->valid_sel = devm_regmap_field_alloc(&pdev->dev, regmap, regfield[1]);
+ if (IS_ERR(player->valid_sel))
+ return PTR_ERR(player->valid_sel);
return 0;
}