From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E229548549; Wed, 9 Sep 2026 14:28:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788964091; cv=none; b=KwnEHsSnBN0vXnSf1r+o7I3SdHrYVxLbnha/u2NFkuoh+dT0LkAur5fha80Kt41EuFppB351qbJE9XsILF8yhrq8MrIcrwb/abasBNwhhIre5JDxOi+mj5lzESLWxitauqjtaziLP+loFGIJCx88jqc3dfpQt6RMAkF1SXTnYBQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788964091; c=relaxed/simple; bh=HVrohx3SdlL4lJIdoje78ahQLlKjpQredVpeD9rPCMc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nPsuxyFajqIJgGcZVaCNGgkggpsbglOzu1Vz8AbDANq9RHnoAF6iWuO8YEcgpmr0R0rDJE8d9S+4yT7ERYUvK5duP6kLwWjMdc0GfY5svwptLvD2ZeZsm+lkU9eb/5lJ+JDrYpYV0YiuhzYuoru47TWrKVHnubsiYsSUyhs8VcE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SK8YdpqY; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="SK8YdpqY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 880451F00A3A; Wed, 9 Sep 2026 14:28:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788964090; bh=5IZOhbgd+VALptQjDcCxEe25XYNbTKIBiKUjrvkJF4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SK8YdpqYpPUZsYCKqZAil8zJ3O3yKYoHfoZjFTWUawqblH1x6jRJmBA+JGpawFmgs YtchJYbnWwqeplKLf3l20IEcihb25R4f2mEyET68eD/OPeoga7EvU5ylSIK+IqBJke goEWp4BorQ7dCwwoqCgQz1slrCsyd/Y7vWOc34Vw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ijae Kim , Myeonghun Pak , Sean Young Subject: [PATCH 6.18 302/583] media: rc: sunxi-cir: Unregister rc device on probe failure Date: Wed, 9 Sep 2026 15:39:47 +0200 Message-ID: <20260909134248.486099379@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909134237.773280130@linuxfoundation.org> References: <20260909134237.773280130@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Myeonghun Pak commit 479aa6fa8c50f1052f1451326ef7d4d586d340c3 upstream. 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") Cc: stable@vger.kernel.org Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak Signed-off-by: Sean Young Signed-off-by: Greg Kroah-Hartman --- drivers/media/rc/sunxi-cir.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/media/rc/sunxi-cir.c +++ b/drivers/media/rc/sunxi-cir.c @@ -344,22 +344,25 @@ static int sunxi_ir_probe(struct platfor 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);