From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6032CAC5AC for ; Tue, 23 Sep 2025 15:15:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5AAAF10E136; Tue, 23 Sep 2025 15:15:19 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="JoG6UHcc"; dkim-atps=neutral Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id E406110E1D3 for ; Tue, 23 Sep 2025 15:15:17 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 06A08601F0; Tue, 23 Sep 2025 15:15:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5AC5C4CEF5; Tue, 23 Sep 2025 15:15:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758640516; bh=DpWHQGigTbPm8gcTYl8TZGOSyPPjUZHRqNSp0PuxL5I=; h=From:To:Cc:Subject:Date:From; b=JoG6UHccek/HejhsWYNCG4U9q5yKyuDXrXW4Kf5fYXiWWW5RoPw0Dy7BDvBYKXbc8 Bm/+jxAExEylddeRevAIff9IgNSO6mE8aLFuCXY4EUsTv/B4AsixuyP7k7pKv5t5xZ cnnOIEq1H1MWRiybjp7Iene2c3lPLKA22HAbz3PgIwGfhQNiAi4Jd7AFIF3p7xIuyv jevnnKRQ7PBhcBDhPkmrQwfd6YvLTPXzZEBewsGyoIzS8fLZgNaZoWGANT1fh87iFZ XbuaGV04X+SfqNndHPhZn+iUhvj/MXmbhhLJijjdaP/29s67470YpAxznys1sZ5r5e trhNn6nok0OTA== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1v14jW-000000004a8-2ula; Tue, 23 Sep 2025 17:15:10 +0200 From: Johan Hovold To: Philipp Zabel Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH] drm/imx/tve: fix probe device leak Date: Tue, 23 Sep 2025 17:13:46 +0200 Message-ID: <20250923151346.17512-1-johan@kernel.org> X-Mailer: git-send-email 2.49.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Make sure to drop the reference taken to the DDC device during probe on probe failure (e.g. probe deferral) and on driver unbind. Fixes: fcbc51e54d2a ("staging: drm/imx: Add support for Television Encoder (TVEv2)") Cc: stable@vger.kernel.org # 3.10 Cc: Philipp Zabel Signed-off-by: Johan Hovold --- drivers/gpu/drm/imx/ipuv3/imx-tve.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/imx/ipuv3/imx-tve.c b/drivers/gpu/drm/imx/ipuv3/imx-tve.c index c5629e155d25..895413d26113 100644 --- a/drivers/gpu/drm/imx/ipuv3/imx-tve.c +++ b/drivers/gpu/drm/imx/ipuv3/imx-tve.c @@ -525,6 +525,13 @@ static const struct component_ops imx_tve_ops = { .bind = imx_tve_bind, }; +static void imx_tve_put_device(void *_dev) +{ + struct device *dev = _dev; + + put_device(dev); +} + static int imx_tve_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -546,6 +553,11 @@ static int imx_tve_probe(struct platform_device *pdev) if (ddc_node) { tve->ddc = of_find_i2c_adapter_by_node(ddc_node); of_node_put(ddc_node); + + ret = devm_add_action_or_reset(dev, imx_tve_put_device, + &tve->ddc->dev); + if (ret) + return ret; } tve->mode = of_get_tve_mode(np); -- 2.49.1