Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1191068ybk; Sat, 16 May 2020 03:59:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYX/KkVYKu8Fz3IPTqVxzB7g9w5WePnEtMgeEP6QoydaoV50bC1nRZXVEtwjO/Tp9CLgNd X-Received: by 2002:a17:906:c401:: with SMTP id u1mr6649202ejz.151.1589626783790; Sat, 16 May 2020 03:59:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589626783; cv=none; d=google.com; s=arc-20160816; b=Heb81dW/FYU7y4wUMKWX5Cloee5VlQu/LivA9u63c5o9YxUmevmzUjCnmi003w3Tfi D1Zx0GXo4P2zmHun06DVD0q2SLYgGpBwFwZoK+0thGOhHCYILjehWYeZtK09MEwwConB Ptss+SwlhofMH0xHFxxFP5rBuW3+UzrsK5hGELzBxQlLkvFKAgbHKk/39obWJbDQrviu nN/yxgkmG63pHFHpMWOZh+reVWBWpONeaNfATZ2kS11ZRDTqqIB/eyeNmm41+vk26mtQ pOmmkr12jupIeIznaIWK7rVwNMxaTVoiTC3drNwb7hvxyw3rckQoZ4ypokvzmVSNf4jC PGRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=tKI8e9iWRGbkUiX8dRfmPe9pnozWonC4RHZXJZEXa64=; b=Y5RVQJRBinhOQDThyINaT7JiFWc+wR2QocgLFFUvFhgT+GL/KomNQoztCUuLW8bPGH Pf2CHec1NfLJNs2MUzZZMzt3hW7KC/H4EA8Xj8gNAdpfh7WtZBKVVY98E4WOwJH5LtSC Yht02+f/SLip9xcAMK9l2dsSbszhqNhziopXekNAZkdfjTgMMIa7irabQMZshIvJzlaz ONYVaK2QjQFzTDuL9uFV8y8h7uyTiegc7UiVnlh3Ev/4mpgtp6kFBqJ6nbPGOuASEyGf G3m0l8nDkSB69MmCkvDf78Ck5Sye7qE2UGohA7GRt4CjxAOgkXAxbhUOxW53GxpkNggM rgzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qx7si3062653ejb.526.2020.05.16.03.59.19; Sat, 16 May 2020 03:59:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726238AbgEPK5q (ORCPT + 99 others); Sat, 16 May 2020 06:57:46 -0400 Received: from smtp07.smtpout.orange.fr ([80.12.242.129]:24133 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725853AbgEPK5q (ORCPT ); Sat, 16 May 2020 06:57:46 -0400 Received: from localhost.localdomain ([93.22.148.0]) by mwinf5d14 with ME id fNxd2200K00kvqt03Nxeb5; Sat, 16 May 2020 12:57:43 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 16 May 2020 12:57:43 +0200 X-ME-IP: 93.22.148.0 From: Christophe JAILLET To: inki.dae@samsung.com, jy0922.shim@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@linux.ie, daniel@ffwll.ch, kgene@kernel.org, krzk@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH v2] drm/exynos: dsi: Remove bridge node reference in error handling path in probe function Date: Sat, 16 May 2020 12:57:36 +0200 Message-Id: <20200516105736.269669-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'exynos_dsi_parse_dt()' takes a reference to 'dsi->in_bridge_node'. This must be released in the error handling path. In order to do that, add an error handling path and move the 'exynos_dsi_parse_dt()' call from the beginning to the end of the probe function to ease the error handling path. This function only sets some variables which are used only in the 'transfer' function. The call chain is: .transfer --> exynos_dsi_host_transfer --> exynos_dsi_init --> exynos_dsi_enable_clock (use burst_clk_rate and esc_clk_rate) --> exynos_dsi_set_pll (use pll_clk_rate) While at it, also handle cases where 'component_add()' fails. This patch is similar to commit 70505c2ef94b ("drm/exynos: dsi: Remove bridge node reference in removal") which fixed the issue in the remove function. Signed-off-by: Christophe JAILLET --- A Fixes tag could be required, but I've not been able to figure out which one to use. v2: move around 'exynos_dsi_parse_dt' instead of adding many gotos handle component_add failures --- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 902938d2568f..a9d24402fabf 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1759,10 +1759,6 @@ static int exynos_dsi_probe(struct platform_device *pdev) dsi->dev = dev; dsi->driver_data = of_device_get_match_data(dev); - ret = exynos_dsi_parse_dt(dsi); - if (ret) - return ret; - dsi->supplies[0].supply = "vddcore"; dsi->supplies[1].supply = "vddio"; ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(dsi->supplies), @@ -1823,11 +1819,25 @@ static int exynos_dsi_probe(struct platform_device *pdev) return ret; } + ret = exynos_dsi_parse_dt(dsi); + if (ret) + return ret; + platform_set_drvdata(pdev, &dsi->encoder); pm_runtime_enable(dev); - return component_add(dev, &exynos_dsi_component_ops); + ret = component_add(dev, &exynos_dsi_component_ops); + if (ret) + goto err_disable_runtime; + + return 0; + +err_disable_runtime: + pm_runtime_disable(dev); + of_node_put(dsi->in_bridge_node); + + return ret; } static int exynos_dsi_remove(struct platform_device *pdev) -- 2.25.1