From patchwork Mon Mar 2 22:26:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11416657 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 D84C514B4 for ; Mon, 2 Mar 2020 22:28:27 +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 B682020866 for ; Mon, 2 Mar 2020 22:28:27 +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="RVEHrfgt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B682020866 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 081C26E8DC; Mon, 2 Mar 2020 22:27:35 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 844DC6E8C3 for ; Mon, 2 Mar 2020 22:27:30 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id i10so935712wmd.1 for ; Mon, 02 Mar 2020 14:27:30 -0800 (PST) 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=6DriMqNrv3MKXMhvrVNVwIC8amEVGk3oHUDtDqCIMXk=; b=RVEHrfgtQxq1/nzEhU76zs0XvyioZOCh6pO18ycvt28PFf40wBw78qU3QJwKNhBeP4 nBha0WE/zkFiW1PQ2n5vGTvXfX/ic3z/a1PvQqtoDprhunYTTrjZeNrQsuZgZQFpas/k Do4rhll0llCtI7E7L2OeRJp75Np7PBusjXIIk= 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=6DriMqNrv3MKXMhvrVNVwIC8amEVGk3oHUDtDqCIMXk=; b=M3g1GD4MT5F44OmyfM+xg0Lgi0jLKSz+ZXJp7NtWPNuRw0BoEAxWPe+eROihYLcoV0 d/2j1XHAGipSw2mG2e1qkFbc4tpj2BTf9vUgPFS+22Put4Kl/uZlumqVHQAMOGcdSkv+ jbQf+AiOH6y8bIjDsxBHNJCFHZlDQVhZ/bj71546W99WXbmME+ZR1A25OLuT3ZpjzB5P 89wNZmhsCEoUV7YXQoJD6XoYq8U1xU1QDlIneXI0vvZ3usxh2p/Z2Q+AGAMPR+HXav02 xiUiMOMvs9LCRsitMtw3PpQHMjFkzH2ksNG+lujv8TGQaEWYycOVbcliNLg+C5mNJng8 awnQ== X-Gm-Message-State: ANhLgQ2GN2UsombTc1SuAuQB8hhojsBwiKKyXRq4VLccJdxIoKelcmUy c62PsREOc/vXTuBb3ArUY0LFMg== X-Google-Smtp-Source: ADFU+vsn4MKfj97OsTbMi8CfKepnUCKiQDy0RxR/F7ytd7UoGiLxVxGT7CFnLk/JK8IVIJovtQCHZg== X-Received: by 2002:a7b:cb17:: with SMTP id u23mr572046wmj.12.1583188048768; Mon, 02 Mar 2020 14:27:28 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id o18sm26114589wrv.60.2020.03.02.14.27.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Mar 2020 14:27:28 -0800 (PST) From: Daniel Vetter To: DRI Development Date: Mon, 2 Mar 2020 23:26:19 +0100 Message-Id: <20200302222631.3861340-40-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200302222631.3861340-1-daniel.vetter@ffwll.ch> References: <20200302222631.3861340-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 39/51] drm/shmob: 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 , linux-renesas-soc@vger.kernel.org, Kieran Bingham , 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: Another driver with a bit much devm_kzalloc, which should probably use drmm_kzalloc instead ... v2: Explain why this cleanup is possible (Laurent). v3: Use drmm_mode_config_init() for more clarity (Sam, Thomas) Cc: Sam Ravnborg Cc: Thomas Zimmermann Reviewed-by: Laurent Pinchart (v2) Cc: Laurent Pinchart Signed-off-by: Daniel Vetter Cc: Laurent Pinchart Cc: Kieran Bingham Cc: linux-renesas-soc@vger.kernel.org --- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 2 -- drivers/gpu/drm/shmobile/shmob_drm_kms.c | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c index b8c0930959c7..ae9d6b8d3ca8 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c @@ -192,7 +192,6 @@ static int shmob_drm_remove(struct platform_device *pdev) drm_dev_unregister(ddev); drm_kms_helper_poll_fini(ddev); - drm_mode_config_cleanup(ddev); drm_irq_uninstall(ddev); drm_dev_put(ddev); @@ -288,7 +287,6 @@ static int shmob_drm_probe(struct platform_device *pdev) drm_irq_uninstall(ddev); err_modeset_cleanup: drm_kms_helper_poll_fini(ddev); - drm_mode_config_cleanup(ddev); err_free_drm_dev: drm_dev_put(ddev); diff --git a/drivers/gpu/drm/shmobile/shmob_drm_kms.c b/drivers/gpu/drm/shmobile/shmob_drm_kms.c index c51197b6fd85..7a866d6ce6bb 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_kms.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_kms.c @@ -126,7 +126,11 @@ static const struct drm_mode_config_funcs shmob_drm_mode_config_funcs = { int shmob_drm_modeset_init(struct shmob_drm_device *sdev) { - drm_mode_config_init(sdev->ddev); + int ret; + + ret = drmm_mode_config_init(sdev->ddev); + if (ret) + return ret; shmob_drm_crtc_create(sdev); shmob_drm_encoder_create(sdev);