From patchwork Mon May 20 09:34:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13668145 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 4C640C04FFE for ; Mon, 20 May 2024 09:44:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8816E10E0F5; Mon, 20 May 2024 09:44:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="oTUzr4Cg"; dkim-atps=neutral Received: from msa.smtpout.orange.fr (smtp-70.smtpout.orange.fr [80.12.242.70]) by gabe.freedesktop.org (Postfix) with ESMTPS id 20A3710E568 for ; Mon, 20 May 2024 09:43:57 +0000 (UTC) Received: from localhost.localdomain ([86.243.17.157]) by smtp.orange.fr with ESMTPA id 8zPjslTpy8GJA8zPjsKGeh; Mon, 20 May 2024 11:34:43 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1716197683; bh=bGqQuOEblhAm3peYnZztYMLeh0ncPzzrHa3zUm2ihUg=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=oTUzr4CgJ6FLx6ZgfRHMG1ly1+nqheFVnGDh8WEpzjTwnS6lXkT48+ruiXWnaZzLM tB8onbUJyl/Cr/5Ws+TElQS8zZaHT4wJuirCmcDnUNAyDAQTKTXCduuWcBwDs4UEic vaWqvbPozYOxYMNrOby0imhcE/uRcyrUJp13y1Pk1JlnXUx5Re7qmM9FJtew+wqouc 5VnuiqU5RGZKWOwtNBuAtQjLLOl1vKSJOyc0d15Pikiaq+sOZl8cxVtIEPw0hrnkDR 664iNHRCDMI8Nmnr63+GfbXwGuvwWVQmLGFnxUqrhHehwyvRLId4X17qMFDNz1+8bz ZaYljy5npEpMA== X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 20 May 2024 11:34:43 +0200 X-ME-IP: 86.243.17.157 From: Christophe JAILLET To: Sumit Semwal , Caleb Connolly , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Vinod Koul , Dmitry Baryshkov , Marijn Suijten Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , Caleb Connolly , dri-devel@lists.freedesktop.org Subject: [PATCH] drm/panel: lg-sw43408: Fix an error handling path in sw43408_probe() Date: Mon, 20 May 2024 11:34:31 +0200 Message-ID: X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 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" If mipi_dsi_attach() fails, we must undo the drm_panel_add() call hidden in sw43408_add(), as already done in the remove function. Fixes: 069a6c0e94f9 ("drm: panel: Add LG sw43408 panel driver") Signed-off-by: Christophe JAILLET Reviewed-by: Dmitry Baryshkov --- Compile tested only --- drivers/gpu/drm/panel/panel-lg-sw43408.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-lg-sw43408.c b/drivers/gpu/drm/panel/panel-lg-sw43408.c index 115f4702d59f..27f2ad788d38 100644 --- a/drivers/gpu/drm/panel/panel-lg-sw43408.c +++ b/drivers/gpu/drm/panel/panel-lg-sw43408.c @@ -286,7 +286,15 @@ static int sw43408_probe(struct mipi_dsi_device *dsi) dsi->dsc = &ctx->dsc; - return mipi_dsi_attach(dsi); + ret = mipi_dsi_attach(dsi); + if (ret < 0) + goto err_remove_panel; + + return 0; + +err_remove_panel: + drm_panel_remove(&ctx->base); + return ret; } static void sw43408_remove(struct mipi_dsi_device *dsi)