]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: rc: st_rc: Fix reset control resource leak
authorHaotian Zhang <vulab@iscas.ac.cn>
Fri, 31 Oct 2025 06:03:32 +0000 (14:03 +0800)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 11 Nov 2025 09:17:33 +0000 (10:17 +0100)
The driver calls reset_control_get_optional_exclusive() but never calls
reset_control_put() in error paths or in the remove function. This causes
a resource leak when probe fails after successfully acquiring the reset
control, or when the driver is unloaded.

Switch to devm_reset_control_get_optional_exclusive() to automatically
manage the reset control resource.

Fixes: a4b80242d046 ("media: st-rc: explicitly request exclusive reset control")
Cc: stable@vger.kernel.org
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/rc/st_rc.c

index 6539fa0a6e79058a96ed434ff5d6e6045c053346..6b70bac5f45d6cbc657f733bdb7c5615cd9b53e2 100644 (file)
@@ -284,7 +284,7 @@ static int st_rc_probe(struct platform_device *pdev)
        else
                rc_dev->rx_base = rc_dev->base;
 
-       rc_dev->rstc = reset_control_get_optional_exclusive(dev, NULL);
+       rc_dev->rstc = devm_reset_control_get_optional_exclusive(dev, NULL);
        if (IS_ERR(rc_dev->rstc)) {
                ret = PTR_ERR(rc_dev->rstc);
                goto err;