From patchwork Mon Mar 23 14:49:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11453269 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 E8FBA174A for ; Mon, 23 Mar 2020 14:51:48 +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 C215620786 for ; Mon, 23 Mar 2020 14:51:48 +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="F/JRVml+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C215620786 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 91C286E1B1; Mon, 23 Mar 2020 14:50:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org 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 0D1AE6E20D for ; Mon, 23 Mar 2020 14:50:55 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id m3so15135618wmi.0 for ; Mon, 23 Mar 2020 07:50:54 -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=Za1bF6q9SnbLT2dlG9RacEv7dXITfnV43EwkE571pzA=; b=F/JRVml+NXMQzY6pwDvbYqXy3GO+gx7CHiglakobw5tixXcqmzpQa8YL78kKowYqY+ vHSwi0sU1F9WAE8DSYUwc4Ew9t9JCUcPbSizGCnV0/rFJFnTMh2XsgVwa9319Y03gTJq ChDI/VpEAzdjd+iXHEfp+ZPvTFcGtogNszBxg= 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=Za1bF6q9SnbLT2dlG9RacEv7dXITfnV43EwkE571pzA=; b=ssfvJ73XzXavFYg61HzxHQ/gd5QANDuxN6VMKsYkTCmcBhBZWJLwhM5jp0pmTDcriH tUueH5z79WbZu0tHqqo5fQvAfvjEdKHyZpUFLhiwdLLB2BcE7JV2vMjo4hpt6svVr2T/ b4bSg5GFZo09fAd4+AiNN2zyFIDfd2CTlztuDOYRMzQxo9toeyvKsR36Jx7N6+KjrPkN YvXGdNaUNhAbERqDLgKnAIq9TXGDUlTcd7nQfQ9CW4yz7STl6szE1I/ho6QbMhwLo/Vt AzFmRgQywJg851vHki7ZN/bdm3b/Fzqd+6pvQwK6v9PcELhzVgvqr86ZJqqp3ESl8rBt Wlrg== X-Gm-Message-State: ANhLgQ1FV29kcJZYq8BQduXPtylVe4noiqzKVxThRc2roTvCrYwuquIK /faz4L1AxQS5MXIGbF4Xy25Lcohz5odJ/w== X-Google-Smtp-Source: ADFU+vtG5OpGrjZlPOoT2PK7yv6S1SZWX0aj0+3nc4cGeOC5PoRvBL6VZZs/WwMmGgIhAsKrO+XdBQ== X-Received: by 2002:a1c:48c1:: with SMTP id v184mr27635278wma.20.1584975052499; Mon, 23 Mar 2020 07:50:52 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2020 07:50:51 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 39/51] drm/shmob: Drop explicit drm_mode_config_cleanup call Date: Mon, 23 Mar 2020 15:49:38 +0100 Message-Id: <20200323144950.3018436-40-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 , linux-renesas-soc@vger.kernel.org, Kieran Bingham , Laurent Pinchart , Thomas Zimmermann , Daniel Vetter , Sam Ravnborg 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) 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);