Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7094359rwp; Tue, 18 Jul 2023 09:57:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlHri4T49Vnc4eP4AOfomukBkiRxaqEvxl5C0FdjA0DDFoM4pKoL0qJwnf99AbvVGwHSaFkx X-Received: by 2002:a92:1901:0:b0:345:e438:7381 with SMTP id 1-20020a921901000000b00345e4387381mr2104811ilz.2.1689699463990; Tue, 18 Jul 2023 09:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689699463; cv=none; d=google.com; s=arc-20160816; b=z46L6LY5Qz2KwWOmuyfV8ggb3V24mvS6gOSBlJMvZDrlRY5iiLxf62554ImM+V9WuJ PBG4Wuafehu0cTbdke01NMomyhPQN3gF+NsVY9iZRv4O6Ht6ZqFU0JGWHB881B3EmUTE G0nBJhftdlfRqcTGcHQaQSobTEOA7qnZxwPnr38vED0XVlxEt2SqdHxEd2PA3VLCvWQw nkxtAz9lCTJZaYYAOGERDbsXsICY6q6rYh2mbI28noi2n0lFqgpoT+EvKjDfxnWc223H qWnA7h75ZMvrOtpf2DO8m7ma3A14q/1hBWtQ033f9qM9T9ngh1KfST5/OKZZqTHKjdZ0 6KKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=L0blw3xoM6NrLuaG/sUU1f5gdREvesQmBKxPvafZtE4=; fh=tA0tLsibEoQ30Z7eqHvQDapDuvXXp6os5IletQHgjxM=; b=t5CIlphTBN1q5cM3DTcnsg2XCkin76g8I3U+Dsd/R30hPXgXWpfYsDeUvcifVYVk0a kyik+mWHrmHLOonsD6RM4IP6dVxKdlKx8ZMbBEm1i26URJehjSRl3rne7hlR0yPe9w5U iT6JDTG9a58PZuiNRkpgmo9uv7YdsyHdvLPJ3n+3TBVih+KPEo9OY6ry9Z9hUB2N5lQY V4un9tGXGUMrQ4NhwhQ5v46B1JjJIgTxVxkgBxToxH+Thxw2pV7GS2NeenkEHGWVOXQJ 79pQ/LejiZsrE0ETI0nQI+OiDjeOfvykhoaHzLcZl/Ks35vSdgecjVql3bHrGP7jx++V hTjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w184-20020a6362c1000000b00540102a876csi1790538pgb.73.2023.07.18.09.57.30; Tue, 18 Jul 2023 09:57:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233420AbjGRQ4K (ORCPT + 99 others); Tue, 18 Jul 2023 12:56:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230350AbjGRQzD (ORCPT ); Tue, 18 Jul 2023 12:55:03 -0400 Received: from albert.telenet-ops.be (albert.telenet-ops.be [IPv6:2a02:1800:110:4::f00:1a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02751171A for ; Tue, 18 Jul 2023 09:54:54 -0700 (PDT) Received: from ramsan.of.borg ([84.195.187.55]) by albert.telenet-ops.be with bizsmtp id Ngur2A00a1C8whw06gurSo; Tue, 18 Jul 2023 18:54:51 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qLnyD-001nYe-Cr; Tue, 18 Jul 2023 18:54:51 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qLnyN-000gcc-Dt; Tue, 18 Jul 2023 18:54:51 +0200 From: Geert Uytterhoeven To: Laurent Pinchart , Kieran Bingham , David Airlie , Daniel Vetter , Thomas Zimmermann , Magnus Damm Cc: linux-renesas-soc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 19/41] drm: renesas: shmobile: Use drmm_universal_plane_alloc() Date: Tue, 18 Jul 2023 18:54:24 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to the comments for drm_universal_plane_init(), the plane structure should not be allocated with devm_kzalloc(). Fix lifetime issues by using drmm_universal_plane_alloc() instead. Signed-off-by: Geert Uytterhoeven --- v2: - Split off removal of call to drm_plane_force_disable(). --- .../gpu/drm/renesas/shmobile/shmob_drm_plane.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c index 3a5db319bad14218..1fb68b5fe915b8dc 100644 --- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c +++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_plane.c @@ -179,7 +179,6 @@ static int shmob_drm_plane_disable(struct drm_plane *plane, static const struct drm_plane_funcs shmob_drm_plane_funcs = { .update_plane = shmob_drm_plane_update, .disable_plane = shmob_drm_plane_disable, - .destroy = drm_plane_cleanup, }; static const uint32_t formats[] = { @@ -198,19 +197,16 @@ static const uint32_t formats[] = { int shmob_drm_plane_create(struct shmob_drm_device *sdev, unsigned int index) { struct shmob_drm_plane *splane; - int ret; - splane = devm_kzalloc(sdev->dev, sizeof(*splane), GFP_KERNEL); - if (splane == NULL) - return -ENOMEM; + splane = drmm_universal_plane_alloc(sdev->ddev, struct shmob_drm_plane, + plane, 1, &shmob_drm_plane_funcs, + formats, ARRAY_SIZE(formats), NULL, + DRM_PLANE_TYPE_OVERLAY, NULL); + if (IS_ERR(splane)) + return PTR_ERR(splane); splane->index = index; splane->alpha = 255; - ret = drm_universal_plane_init(sdev->ddev, &splane->plane, 1, - &shmob_drm_plane_funcs, - formats, ARRAY_SIZE(formats), NULL, - DRM_PLANE_TYPE_OVERLAY, NULL); - - return ret; + return 0; } -- 2.34.1