From patchwork Mon Mar 23 14:49:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11453255 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 29252174A for ; Mon, 23 Mar 2020 14:51:41 +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 072C420753 for ; Mon, 23 Mar 2020 14:51:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="EI4qcfvH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 072C420753 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1DFC6E24B; Mon, 23 Mar 2020 14:50:52 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0CEED6E23D for ; Mon, 23 Mar 2020 14:50:48 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id 6so14959561wmi.5 for ; Mon, 23 Mar 2020 07:50:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vhigyKX9leg2iRyigV9HwacIFKw6VhyeDGQ4LS+tHAw=; b=EI4qcfvH7/wIMCwpH2bHw4s/F6TLnfnqHk26+1BrynGKKNv8NCVt0DRPWTxEYaC1a6 upwkf8ZUmOEpBDVxli5EpISJxLavDb5Z4a7KcLQPNz0ufRfVoBLzYHr3feeNmTDBrXaz noR4906a0EtNsTPfoKMRQWLg20pBH1ps2Yay0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vhigyKX9leg2iRyigV9HwacIFKw6VhyeDGQ4LS+tHAw=; b=TCIh8vsu9oV/WFMaGO2YCTyrVBSvAFoFl2/VxsNd3c/dlrtuH9pwJbGRC+a/7M0Jr5 O9OIuHMqRZvpCXhgs6mVamy2BNRktCwY3SKxD/fiSNGK30hoOXRaKkmasF+S4kfYIYhc xBwDFuODKOuaTyq9BkSdu5seN04N6bFnNs34c/5SfRdMDt8+YmcO/+S1AtJo8/H9QoHY Q1ok/gyOwo81miGktagX1Akgs7eeWb27BtfEVFXhOQoyQI24+T6kXi6ZqPae1+9w2eRT QHpS2LI4bnZ8ECcq+w2fl2MamYedgf/uXlL2KMJUWNUPvbIjrZ1IkHSebcHFyWybypKe BHNw== X-Gm-Message-State: ANhLgQ1dUVmnFXaBMvGM4rU6pWmAaAY3NppmhbNs2mUrYX2SYaE9HLvs v4xl/KCuSGW74OhykPjT/Ff38Q== X-Google-Smtp-Source: ADFU+vuJ0JzogfCzm96Rw/0szJ5Z6Xz0J5IARsp8LYKAfoomhQPSs6N6E7zRQjqgergX0znTi9xNOA== X-Received: by 2002:a05:600c:2943:: with SMTP id n3mr6730987wmd.119.1584975046660; Mon, 23 Mar 2020 07:50:46 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id s22sm20376522wmc.16.2020.03.23.07.50.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2020 07:50:46 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Mon, 23 Mar 2020 15:49:34 +0100 Message-Id: <20200323144950.3018436-36-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200323144950.3018436-1-daniel.vetter@ffwll.ch> References: <20200323144950.3018436-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 35/51] drm/pl111: Drop explicit drm_mode_config_cleanup call X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , Eric Anholt , Laurent Pinchart , Thomas Zimmermann , Daniel Vetter , Sam Ravnborg Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" It's right above the drm_dev_put(). This is made possible by a preceeding patch which added a drmm_ cleanup action to drm_mode_config_init(), hence all we need to do to ensure that drm_mode_config_cleanup() is run on final drm_device cleanup is check the new error code for _init(). Aside: This driver gets its devm_ stuff all wrong wrt drm_device and anything hanging off that. Not the only one unfortunately. v2: Explain why this cleanup is possible (Laurent). v3: Use drmm_mode_config_init() for more clarity (Sam, Thomas) Acked-by: Sam Ravnborg Cc: Sam Ravnborg Cc: Thomas Zimmermann Cc: Laurent Pinchart Signed-off-by: Daniel Vetter Cc: Eric Anholt --- drivers/gpu/drm/pl111/pl111_drv.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index aa8aa8d9e405..f9ca0f3edbbb 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -90,10 +90,13 @@ static int pl111_modeset_init(struct drm_device *dev) struct drm_panel *panel = NULL; struct drm_bridge *bridge = NULL; bool defer = false; - int ret = 0; + int ret; int i; - drm_mode_config_init(dev); + ret = drmm_mode_config_init(dev); + if (ret) + return ret; + mode_config = &dev->mode_config; mode_config->funcs = &mode_config_funcs; mode_config->min_width = 1; @@ -154,7 +157,7 @@ static int pl111_modeset_init(struct drm_device *dev) DRM_MODE_CONNECTOR_Unknown); if (IS_ERR(bridge)) { ret = PTR_ERR(bridge); - goto out_config; + goto finish; } } else if (bridge) { dev_info(dev->dev, "Using non-panel bridge\n"); @@ -197,8 +200,6 @@ static int pl111_modeset_init(struct drm_device *dev) out_bridge: if (panel) drm_panel_bridge_remove(bridge); -out_config: - drm_mode_config_cleanup(dev); finish: return ret; } @@ -343,7 +344,6 @@ static int pl111_amba_remove(struct amba_device *amba_dev) drm_dev_unregister(drm); if (priv->panel) drm_panel_bridge_remove(priv->bridge); - drm_mode_config_cleanup(drm); drm_dev_put(drm); of_reserved_mem_device_release(dev);