Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751660AbdGRKUh (ORCPT ); Tue, 18 Jul 2017 06:20:37 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:30750 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751407AbdGRKUd (ORCPT ); Tue, 18 Jul 2017 06:20:33 -0400 From: Philippe CORNU To: Yannick Fertre , Philippe Cornu , Benjamin Gaignard , Vincent Abriou , David Airlie , , CC: Fabien Dessenne , Mickael Reulier , Gabriel Fernandez , Ludovic Barre , Alexandre Torgue , Maxime Coquelin Subject: [PATCH v1 5/7] drm/stm: ltdc: add devm_reset_control & platform_get_ressource Date: Tue, 18 Jul 2017 12:20:17 +0200 Message-ID: <1500373219-20233-6-git-send-email-philippe.cornu@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1500373219-20233-1-git-send-email-philippe.cornu@st.com> References: <1500373219-20233-1-git-send-email-philippe.cornu@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.201.23.32] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-18_04:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1464 Lines: 51 Use devm_reset_control_get to avoid resource leakage. Also use platform_get_resource, which is more usual and consistent with platform_get_irq called later. Signed-off-by: Fabien Dessenne Signed-off-by: Philippe CORNU --- drivers/gpu/drm/stm/ltdc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 92e58ba..f4ed21a 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -874,7 +874,7 @@ int ltdc_load(struct drm_device *ddev) struct drm_panel *panel; struct drm_crtc *crtc; struct reset_control *rstc; - struct resource res; + struct resource *res; int irq, ret, i; DRM_DEBUG_DRIVER("\n"); @@ -883,7 +883,7 @@ int ltdc_load(struct drm_device *ddev) if (ret) return ret; - rstc = of_reset_control_get(np, NULL); + rstc = devm_reset_control_get(dev, NULL); mutex_init(&ldev->err_lock); @@ -898,13 +898,14 @@ int ltdc_load(struct drm_device *ddev) return -ENODEV; } - if (of_address_to_resource(np, 0, &res)) { + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { DRM_ERROR("Unable to get resource\n"); ret = -ENODEV; goto err; } - ldev->regs = devm_ioremap_resource(dev, &res); + ldev->regs = devm_ioremap_resource(dev, res); if (IS_ERR(ldev->regs)) { DRM_ERROR("Unable to get ltdc registers\n"); ret = PTR_ERR(ldev->regs); -- 1.9.1