From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF49FC54FD0 for ; Mon, 23 Mar 2020 14:51:46 +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 B6F9B20753 for ; Mon, 23 Mar 2020 14:51:46 +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="MCdjundm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6F9B20753 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch 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 EADC16E22F; Mon, 23 Mar 2020 14:50:56 +0000 (UTC) Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 450136E1BC for ; Mon, 23 Mar 2020 14:50:55 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id z18so6168064wmk.2 for ; Mon, 23 Mar 2020 07:50:55 -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=BfNcfzXzod5et4gZdZfA0i/WllJb5oAUY9TNrkd8Ruc=; b=MCdjundmMRmdHl4v12B4y1i6uu4Cif0JgqysLnAAIxOpCfRNPu224nCps5WLONJ0eG UUoj0r2S5+xa/zhFTsNFno42TBvDbEqfPcew5uTn61FlJx8zD5iNcCgJ5kJjtGAgzF7D EYiaDDpdnmJ7TGRKARrN3XEdgQLy6essoFvRY= 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=BfNcfzXzod5et4gZdZfA0i/WllJb5oAUY9TNrkd8Ruc=; b=hySvxEF8InjXEgSuX89K9bgKP/1LxiFp7gyW0QGjkiHMZE6+xwmktmmSuGCdHuwOmE ZKEn++MAOBOU8cvjHuW0HZ1EYkkqFZaXYKpK0OOcSwH+St4sMqzNwymgtPJU2rdAy5JM UdnhervKUd+/GRin+12tqQurzEPRrlOub5bzOBn5aMl21VoxSE5j896iBKAIHEmcIRHI TKNCAzm0c7nyip2KS5pJJTQwEJubA/2bAa/89PMOLAHTRzS78nJLlJNDO13kpzeVKXZW TS3aDh110r/rtv4JlpJnCTc6gohFYr/hT//i/XhijeMzZyrD3EfviFA0z8js1SqIDrW5 /QXQ== X-Gm-Message-State: ANhLgQ1PZ0DqK5Obyj7k2gCkhbXU5bcyv62O6yVgkNjsP0nWJ+JFGBn7 M6iIH+SdcA/DJc5fP01q+r5FdpwvDjcwzQ== X-Google-Smtp-Source: ADFU+vt5bRLY1O2h8cJ+7oLzXBh6Zgi0x1W+hpvpzoUuBANjxe2sSrcMlBNwMXJSvmoBwQEA1kT3fw== X-Received: by 2002:a1c:2002:: with SMTP id g2mr3814236wmg.122.1584975053620; Mon, 23 Mar 2020 07:50:53 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2020 07:50:52 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 40/51] drm/mtk: Drop explicit drm_mode_config_cleanup call Date: Mon, 23 Mar 2020 15:49:39 +0100 Message-Id: <20200323144950.3018436-41-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 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: Daniel Vetter , Intel Graphics Development , Laurent Pinchart , Thomas Zimmermann , Daniel Vetter , Sam Ravnborg Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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) Acked-by: Sam Ravnborg Cc: Sam Ravnborg Cc: Thomas Zimmermann Cc: Laurent Pinchart Signed-off-by: Daniel Vetter --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 0563c6813333..2eaa9080d250 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -162,7 +162,9 @@ static int mtk_drm_kms_init(struct drm_device *drm) } private->mutex_dev = &pdev->dev; - drm_mode_config_init(drm); + ret = drmm_mode_config_init(drm); + if (ret) + return ret; drm->mode_config.min_width = 64; drm->mode_config.min_height = 64; @@ -179,7 +181,7 @@ static int mtk_drm_kms_init(struct drm_device *drm) ret = component_bind_all(drm->dev, drm); if (ret) - goto err_config_cleanup; + return ret; /* * We currently support two fixed data streams, each optional, @@ -255,8 +257,6 @@ static int mtk_drm_kms_init(struct drm_device *drm) dma_dev->dma_parms = NULL; err_component_unbind: component_unbind_all(drm->dev, drm); -err_config_cleanup: - drm_mode_config_cleanup(drm); return ret; } @@ -272,7 +272,6 @@ static void mtk_drm_kms_deinit(struct drm_device *drm) private->dma_dev->dma_parms = NULL; component_unbind_all(drm->dev, drm); - drm_mode_config_cleanup(drm); } static const struct file_operations mtk_drm_fops = { -- 2.25.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel