Skip to contentSkip to conversation

FAILED: patch "[PATCH] media: i2c: ov8856: free control handler on error in" failed to apply to 5.10-stable tree

PATCH [email protected] 1 participant 1 message May 15

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x f75e160745663ce9b13362ae6e90bd439c58df69
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026051503-polish-carwash-55e9@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From f75e160745663ce9b13362ae6e90bd439c58df69 Mon Sep 17 00:00:00 2001
From: Alexander Koskovich <[email protected]>
Date: Thu, 12 Mar 2026 17:16:20 +0000
Subject: [PATCH] media: i2c: ov8856: free control handler on error in
ov8856_init_controls()

The control handler wasn't freed if adding controls failed, add an error exit label and convert the existing error return to use it.

Fixes 879347f0c258 ("media: ov8856: Add support for OV8856 sensor")
drivers/media/i2c/ov8856.c +8 -2
index e2998cfa0d18..dd01e1d515ff 100644
@@ -1951,12 +1951,18 @@ static int ov8856_init_controls(struct ov8856 *ov8856)
 			  V4L2_CID_HFLIP, 0, 1, 1, 0);
 	v4l2_ctrl_new_std(ctrl_hdlr, &ov8856_ctrl_ops,
 			  V4L2_CID_VFLIP, 0, 1, 1, 0);
-	if (ctrl_hdlr->error)
-		return ctrl_hdlr->error;
+	if (ctrl_hdlr->error) {
+		ret = ctrl_hdlr->error;
+		goto err_ctrl_handler_free;
+	}
 
 	ov8856->sd.ctrl_handler = ctrl_hdlr;
 
 	return 0;
+
+err_ctrl_handler_free:
+	v4l2_ctrl_handler_free(ctrl_hdlr);
+	return ret;
 }
 
 static void ov8856_update_pad_format(struct ov8856 *ov8856,