From patchwork Tue May 26 01:15:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 11569773 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12D84912 for ; Tue, 26 May 2020 01:16:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E5AEE20812 for ; Tue, 26 May 2020 01:16:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="mNypmlcB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5AEE20812 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6414089E7B; Tue, 26 May 2020 01:15:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2CB6389E1B for ; Tue, 26 May 2020 01:15:51 +0000 (UTC) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AC2641C88; Tue, 26 May 2020 03:15:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1590455749; bh=Gqb2ws55rij00jZ+ItJ3UN/h8OQTFGoMoOeB89EWlpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mNypmlcBjfaI9LdF/l2V22gFhOqnkj37CU+celyhqZf6alBJ7OPNSAZbQzeQNtqjz aUuHDM8sa6lRSlr0isaqIs4K7sGo2YkEex++9q1eDYnWpilAOnQDTpTQEJ0bC1PPQ5 MFZH3HiVI2v4VQseYN/CoP9U98oW/SMSJqxO1VkA= From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH 25/27] drm: rcar-du: Fix error handling in rcar_du_encoder_init() Date: Tue, 26 May 2020 04:15:03 +0300 Message-Id: <20200526011505.31884-26-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200526011505.31884-1-laurent.pinchart+renesas@ideasonboard.com> References: <20200526011505.31884-1-laurent.pinchart+renesas@ideasonboard.com> 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: , Cc: Jernej Skrabec , Neil Armstrong , Jonas Karlman , Kieran Bingham , linux-renesas-soc@vger.kernel.org, Andrzej Hajda , Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When attaching the bridge returns an error, the rcar_du_encoder_init() function calls drm_encoder_cleanup() manually instead of jumping to the error handling path that frees memory. Fix it. Fixes: c6a27fa41fab ("drm: rcar-du: Convert LVDS encoder code to bridge driver") Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c index b0335da0c161..72bf6e2c7933 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c @@ -115,8 +115,9 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu, */ ret = drm_bridge_attach(encoder, bridge, NULL, 0); if (ret) { - drm_encoder_cleanup(encoder); - return ret; + dev_err(rcdu->dev, "failed to attach bridge for output %u\n", + output); + goto done; } done: