Skip to contentSkip to conversation

FAILED: patch "[PATCH] media: rc: sunxi-cir: Unregister rc device on probe failure" failed to apply to 5.10-stable tree

PATCH New [email protected] 2 participants 3 messages Sep 9 – Sep 11

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 479aa6fa8c50f1052f1451326ef7d4d586d340c3
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090910-petal-cupcake-2b81@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

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

From 479aa6fa8c50f1052f1451326ef7d4d586d340c3 Mon Sep 17 00:00:00 2001
From: Myeonghun Pak <[email protected]>
Date: Wed, 13 May 2026 16:11:03 +0900
Subject: [PATCH] media: rc: sunxi-cir: Unregister rc device on probe failure

After rc_register_device() succeeds, later probe failures must undo the registration with rc_unregister_device(). The current error path jumps to the allocation cleanup label and only calls rc_free_device(), leaving the rc device registration and resources created by rc_register_device() behind.

Add a registered-device unwind label for the IRQ lookup, IRQ request, and hardware initialization failure paths. Keep rc_free_device() for failures before rc_register_device() succeeds.

Fixes b4e3e59fb59c ("[media] rc: add sunxi-ir driver")
drivers/media/rc/sunxi-cir.c +6 -3
index cb4c56bf0752..28e840a7e5b8 100644
@@ -344,22 +344,25 @@ static int sunxi_ir_probe(struct platform_device *pdev)
 	ir->irq = platform_get_irq(pdev, 0);
 	if (ir->irq < 0) {
 		ret = ir->irq;
-		goto exit_free_dev;
+		goto exit_unregister_dev;
 	}
 
 	ret = devm_request_irq(dev, ir->irq, sunxi_ir_irq, 0, SUNXI_IR_DEV, ir);
 	if (ret) {
 		dev_err(dev, "failed request irq\n");
-		goto exit_free_dev;
+		goto exit_unregister_dev;
 	}
 
 	ret = sunxi_ir_hw_init(dev);
 	if (ret)
-		goto exit_free_dev;
+		goto exit_unregister_dev;
 
 	dev_info(dev, "initialized sunXi IR driver\n");
 	return 0;
 
+exit_unregister_dev:
+	rc_unregister_device(ir->rc);
+
 exit_free_dev:
 	rc_free_device(ir->rc);
 
maintainer
#1 lore raw

PATCH 1/2 media: sunxi-cir: Clean up dead register writes

From: Samuel Holland <[email protected]>

[ Upstream commit 586bb700b3256a1cb38935f83c76e6522ac53d64 ]

The register writes during driver removal occur after the device is already put back in reset, so they never had any effect.

Stable-dep-of: 479aa6fa8c50 ("media: rc: sunxi-cir: Unregister rc device on probe failure")

---
 drivers/media/rc/sunxi-cir.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/media/rc/sunxi-cir.c +0 -10
index 4afc5895bee74..7a67e79d637a3 100644
@@ -310,22 +310,12 @@ static int sunxi_ir_probe(struct platform_device *pdev)
 
 static int sunxi_ir_remove(struct platform_device *pdev)
 {
-	unsigned long flags;
 	struct sunxi_ir *ir = platform_get_drvdata(pdev);
 
 	clk_disable_unprepare(ir->clk);
 	clk_disable_unprepare(ir->apb_clk);
 	reset_control_assert(ir->rst);
 
-	spin_lock_irqsave(&ir->ir_lock, flags);
-	/* disable IR IRQ */
-	writel(0, ir->base + SUNXI_IR_RXINT_REG);
-	/* clear All Rx Interrupt Status */
-	writel(REG_RXSTA_CLEARALL, ir->base + SUNXI_IR_RXSTA_REG);
-	/* disable IR */
-	writel(0, ir->base + SUNXI_IR_CTL_REG);
-	spin_unlock_irqrestore(&ir->ir_lock, flags);
-
 	rc_unregister_device(ir->rc);
 	return 0;
 }
Signature · 1 line
2.53.0
maintainer
#2 lore raw

PATCH 2/2 media: rc: sunxi-cir: Unregister rc device on probe failure

From: Myeonghun Pak <[email protected]>

[ Upstream commit 479aa6fa8c50f1052f1451326ef7d4d586d340c3 ]

After rc_register_device() succeeds, later probe failures must undo the registration with rc_unregister_device(). The current error path jumps to the allocation cleanup label and only calls rc_free_device(), leaving the rc device registration and resources created by rc_register_device() behind.

Add a registered-device unwind label for the IRQ lookup, IRQ request, and hardware initialization failure paths. Keep rc_free_device() for failures before rc_register_device() succeeds.

Fixes b4e3e59fb59c ("[media] rc: add sunxi-ir driver")
[ adapted cleanup for missing sunxi_ir_hw_init() and rc_unregister_device() implicitly freeing the device. ]
---
 drivers/media/rc/sunxi-cir.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/rc/sunxi-cir.c +6 -2
index 7a67e79d637a3..2c8960365b9e7 100644
@@ -259,13 +259,13 @@ static int sunxi_ir_probe(struct platform_device *pdev)
 	ir->irq = platform_get_irq(pdev, 0);
 	if (ir->irq < 0) {
 		ret = ir->irq;
-		goto exit_free_dev;
+		goto exit_unregister_dev;
 	}
 
 	ret = devm_request_irq(dev, ir->irq, sunxi_ir_irq, 0, SUNXI_IR_DEV, ir);
 	if (ret) {
 		dev_err(dev, "failed request irq\n");
-		goto exit_free_dev;
+		goto exit_unregister_dev;
 	}
 
 	/* Enable CIR Mode */
@@ -296,6 +296,10 @@ static int sunxi_ir_probe(struct platform_device *pdev)
 	dev_info(dev, "initialized sunXi IR driver\n");
 	return 0;
 
+exit_unregister_dev:
+	rc_unregister_device(ir->rc);
+	goto exit_clkdisable_clk;
+
 exit_free_dev:
 	rc_free_device(ir->rc);
 exit_clkdisable_clk:
Signature · 1 line
2.53.0