Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4445825rdb; Fri, 15 Sep 2023 02:23:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXNkCUUQOE3dr332k4krBxq3iWzWjZzMIomO4sRXpqla/1HCvO7pe36afMV2lcy/LPxI2o X-Received: by 2002:a17:90a:d18d:b0:262:fc8a:ed1 with SMTP id fu13-20020a17090ad18d00b00262fc8a0ed1mr870293pjb.44.1694769787884; Fri, 15 Sep 2023 02:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694769787; cv=none; d=google.com; s=arc-20160816; b=fN5eze8q2Uyljbn8LL07rbe/1d3yWutNa24AnZd2BsXBajyVopoq4cdsKqMdVOQtpw G2vJoc8a8OGJ9WFLDqgJBOJAVPyYzYsFzkfFTi/gJC9lGYFGDvJckHN/cNGjAjiuxw24 rLOCNtdPG2RmZcITFLDxeB6CBFNrI8dbsA88mlWpVYwV7FdmfdRfVZ88TC01wisuPOl2 sNDfQDCCzx+Rul2A+WlsDryC1r3mg5ZQd5hXhKnxG9cVFx33iG7PYjHG2rPQFSXOEIe3 qiiA53d975GgDmY4do9wFvqUVOMHEkh1J+Ba9Bv9tRMeUibfPoA8AYfRTqTR3lvinVlm R93w== 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=bpaH77Da9YHitOYL1AgXz+zAJkPDUZp8tkAQBU11IUc=; fh=5wQWCF8gEfDP7dQFU6OnqlYZzko8ZfxmYVp1pev3Png=; b=Hq/Wny2KP7rPz/ewOx/qjEGdukzjWP0Ktclf25HUgc9rvGxktP6jrSCxNRAhsTcMXQ Vh8dFqvYRJiqIyzFe+A4EUyj3FuBWiYovx31mhBBISFhumlUWssB69u/P1AMFP+5QQlx gUK61Cpn+oR3jK6YXW59fUM36S0rw17SgPrXmxnWz4M/dGNeMbiu7oMLisIyphwonBTB OfzjwPP0W+fTBcSmJyLvKin4X1oiK/0Bam/cihXCL/9s0aiJJRmyeBi69v4YMm+20ZEI ElesNgBP7XMW6M6AO+bDO85UAkn9x3p+aZYfFp5qr6GBBKmIRZKiP60k7fv8CJQckbpQ t/+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id f19-20020a17090ace1300b0025bcf85bda2si3036600pju.7.2023.09.15.02.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 02:23:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2B3A582265F1; Fri, 15 Sep 2023 01:54:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233383AbjIOIyi (ORCPT + 99 others); Fri, 15 Sep 2023 04:54:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233197AbjIOIyZ (ORCPT ); Fri, 15 Sep 2023 04:54:25 -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 0E4C22722 for ; Fri, 15 Sep 2023 01:54:16 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:7135:da8b:ba1d:1a7c]) by albert.telenet-ops.be with bizsmtp id m8uE2A00j3q21w7068uEYC; Fri, 15 Sep 2023 10:54:15 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qh4aJ-003lH6-L7; Fri, 15 Sep 2023 10:54:14 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qh4ac-00Gdc9-Lg; Fri, 15 Sep 2023 10:54:14 +0200 From: Geert Uytterhoeven To: Laurent Pinchart , Kieran Bingham , David Airlie , Daniel Vetter , Thomas Zimmermann , Magnus Damm Cc: dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v4 19/41] drm: renesas: shmobile: Use drmm_universal_plane_alloc() Date: Fri, 15 Sep 2023 10:53:34 +0200 Message-Id: <65ebf0513e2836227a9636e922f51c668bd69720.1694767209.git.geert+renesas@glider.be> 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=-1.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_NONE autolearn=no 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 15 Sep 2023 01:54:39 -0700 (PDT) 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 --- v4: - No changes, v3: - No changes, 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