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 0CD22EA3F3C for ; Tue, 10 Feb 2026 10:44:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5BEC010E54C; Tue, 10 Feb 2026 10:44:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="n3JSbTNz"; dkim-atps=neutral Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3A4C510E54C for ; Tue, 10 Feb 2026 10:44:21 +0000 (UTC) Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 4ADBC4E40BC5; Tue, 10 Feb 2026 10:44:19 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 03B6A606BD; Tue, 10 Feb 2026 10:44:19 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 35628119D1118; Tue, 10 Feb 2026 11:44:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1770720257; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=rgIZKpgJemM2O7tuO8K6vUcedAgz0oWF401av9M9oVc=; b=n3JSbTNzPPfJM80F/e/8JHK/PLG6zjf37tfVMjKnZYMhvuMrbw+0KmWFM6LCcaoSvdp1zW L7Zc0a2KN806lX4XRiSL2ul+0I4OYgYssPNrlLIiBMoVkXla5L07BnhnQUCXO0v0r7gsC+ RFSv5GXp5LcbmZGzFv5tTZwK2j7zqhuvI0iWFgeI49pT3+IfcB77lionxNxp8txH6otmLU WJaONHLOTQVq080OME35wHuksw66On1DSxoepctGmq+EjHQFlOOzrWy2TliVIn8yr9T78B mEbkbdUfrLg4flbTtpKjsgKWyX0FSsfKt4g0743yTcFBGvPfvUxZP2j5pyJyHg== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 10 Feb 2026 11:44:11 +0100 Message-Id: To: "Osama Abdelkader" , "Inki Dae" , "Jagan Teki" , "Marek Szyprowski" , "Andrzej Hajda" , "Neil Armstrong" , "Robert Foss" , "Laurent Pinchart" , "Jonas Karlman" , "Jernej Skrabec" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "David Airlie" , "Simona Vetter" , "Marek Vasut" , , From: "Luca Ceresoli" Subject: Re: [PATCH] drm/bridge: samsung-dsim: Fix memory leak in error path Cc: X-Mailer: aerc 0.20.1 References: <20260209184115.10937-1-osama.abdelkader@gmail.com> In-Reply-To: <20260209184115.10937-1-osama.abdelkader@gmail.com> X-Last-TLS-Session-Version: TLSv1.3 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" Hello Osama, On Mon Feb 9, 2026 at 7:41 PM CET, Osama Abdelkader wrote: > In samsung_dsim_host_attach(), drm_bridge_add() is called to add the > bridge. However, if samsung_dsim_register_te_irq() or > pdata->host_ops->attach() fails afterwards, the function returns > without removing the bridge, causing a memory leak. > > Fix this by adding proper error handling with goto labels to ensure > drm_bridge_remove() is called in all error paths. Also ensure that > samsung_dsim_unregister_te_irq() is called if the attach operation > fails after the TE IRQ has been registered. > > samsung_dsim_unregister_te_irq() function is moved without changes > to be before samsung_dsim_host_attach() to avoid forward declaration. > > Fixes: e7447128ca4a ("drm: bridge: Generalize Exynos-DSI driver into a Sa= msung DSIM bridge") > Cc: stable@vger.kernel.org > Signed-off-by: Osama Abdelkader > --- > v2: Please add the version number to the e-mail Subject, it should be: [PATCH v2] drm/bridge: ... ^^ No need to resend just for this, but please keep it in mind for the future. Using b4 automates all of this very nicely, you can consider using it. Reviewed-by: Luca Ceresoli -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com