Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4508388rdh; Wed, 29 Nov 2023 03:35:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7tLWxM1ilIONNjiagvUE73zZ6XHdbkUaprwU92/Y58Lr7f24aUjcMfcAwAsFpOIMC3gUg X-Received: by 2002:a05:6808:ec1:b0:3ac:b73a:757f with SMTP id q1-20020a0568080ec100b003acb73a757fmr19440775oiv.39.1701257703884; Wed, 29 Nov 2023 03:35:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701257703; cv=none; d=google.com; s=arc-20160816; b=NN6o9Ja3lGeMBxVVcZcIYuLRUp/JG8hUed6KjR5i0uZ9KghTmZlcXQh93YyQTkOOhW K7Vb1RwW1W3uuzxYMUgxXhj0Al9u41SgbKLNe8Z8ca/gjukFf3u+D0o2YXicmJyG2Ljr VvKKVGWnf+mpGdZwh/DuvoZkUvnDv11QuyptkqcjDvDZuWmqyEw9mK3F8TEbNaUimT2P XuB6lQ1rDOyI5kCMeCtpb7KlWKQ6bgUZysuUaHa6IQVtuTOWGzdMf3kSbnJWqSmlAF/o gaLMoXT8lY59XfSCNa3kxAOpmfkx1yXejfIx5d2B9cXM3dKAw6564iyxPuHXEk345oRD KRyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=ZAsQiqQtYrl7dfrofEu3bEncXTW4ARayG+BTXJ6pdqE=; fh=nNPLatx0gmhUQSJJpE4+fEzpfbIF7/SMNQUixVFGTfg=; b=vyJdvYcobiPnN9YhKS/y73/GY7fchanpbYvaVwZ8weK6ZKmOoiQwnjqRrB9IDBtQ3E Zrd0CD3h+5qews81v8J+TTQlT3xxEvNjOzCgUpWIW3eHW5BMO9I9FNP4HCkOdD+EqzMN CEtjZLQJT0ftMrRaXSgcGeObcgwAFZ0TkxmQGSMG5mnYgiy4rCHvmVZah04WVt9tEYAp T0JqTDfJlYw2RFIL9rnwcvrfA3iSKWu6VkSfPKVunbdb2HhRuBP17gM5w8wDEB1OAi96 LliZDGrWbt7OXlIUjrN39YF2bpY74B3robmfL2oOCpV+gvdSpPxgo3BB7MBzfSyZ/lXN lr/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=JVUaCztk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id k38-20020a63ff26000000b005b92fb731a9si14027594pgi.834.2023.11.29.03.35.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 03:35:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=JVUaCztk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9B8C580A9920; Wed, 29 Nov 2023 03:35:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233059AbjK2Les (ORCPT + 99 others); Wed, 29 Nov 2023 06:34:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233062AbjK2Leq (ORCPT ); Wed, 29 Nov 2023 06:34:46 -0500 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F0F5A10DF for ; Wed, 29 Nov 2023 03:34:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=ZAsQiqQtYrl7dfrofE u3bEncXTW4ARayG+BTXJ6pdqE=; b=JVUaCztkrUfhYVpftCkPcJzISA6ReUW6G6 Lb0ic9gSx8IjfkhQmG53TqHphSEzXyQTlzT72ZtfKWK6iIw3u/W4hIBAqoxcgmIT S2xZL9+j/r0ND6gJP+5I46qfi31vroS9LDV3ENPPIPW4izkH9X5PnVLiG8wTPOd6 4uouplpE8= Received: from localhost.localdomain (unknown [39.144.190.126]) by zwqz-smtp-mta-g5-3 (Coremail) with SMTP id _____wDXXmKvIWdl8CEBEQ--.41793S2; Wed, 29 Nov 2023 19:34:09 +0800 (CST) From: Haoran Liu To: maarten.lankhorst@linux.intel.com Cc: neil.armstrong@linaro.org, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch, khilman@baylibre.com, jbrunet@baylibre.com, martin.blumenstingl@googlemail.com, dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Haoran Liu Subject: [PATCH v2] [drm/meson] meson_plane: Add error handling v2(re-aligned) Date: Wed, 29 Nov 2023 03:34:05 -0800 Message-Id: <20231129113405.33057-1-liuhaoran14@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: _____wDXXmKvIWdl8CEBEQ--.41793S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7WrWfWryftry3Gr48KFy8Zrb_yoW8AFy3pF 47CFyY9ry7Aa1Ut347Ar4YyFW3Ww4rGFyUur18trnYkwnxKFy7Cry3KFZFkFyUXFW5u3Z3 KrnxCr4DCr1ayFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pRb4SrUUUUU= X-Originating-IP: [39.144.190.126] X-CM-SenderInfo: xolxxtxrud0iqu6rljoofrz/1tbiwh83glc661p0cgABsz X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_BL, RCVD_IN_MSPIKE_L4,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 (snail.vger.email [0.0.0.0]); Wed, 29 Nov 2023 03:35:02 -0800 (PST) This patch adds robust error handling to the meson_plane_create function in drivers/gpu/drm/meson/meson_plane.c. The function previously lacked proper handling for potential failure scenarios of the drm_universal_plane_init call. Signed-off-by: Haoran Liu --- drivers/gpu/drm/meson/meson_plane.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c index 815dfe30492b..b43ac61201f3 100644 --- a/drivers/gpu/drm/meson/meson_plane.c +++ b/drivers/gpu/drm/meson/meson_plane.c @@ -534,6 +534,7 @@ int meson_plane_create(struct meson_drm *priv) struct meson_plane *meson_plane; struct drm_plane *plane; const uint64_t *format_modifiers = format_modifiers_default; + int ret; meson_plane = devm_kzalloc(priv->drm->dev, sizeof(*meson_plane), GFP_KERNEL); @@ -548,12 +549,16 @@ int meson_plane_create(struct meson_drm *priv) else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) format_modifiers = format_modifiers_afbc_g12a; - drm_universal_plane_init(priv->drm, plane, 0xFF, - &meson_plane_funcs, - supported_drm_formats, - ARRAY_SIZE(supported_drm_formats), - format_modifiers, - DRM_PLANE_TYPE_PRIMARY, "meson_primary_plane"); + ret = drm_universal_plane_init(priv->drm, plane, 0xFF, + &meson_plane_funcs, + supported_drm_formats, + ARRAY_SIZE(supported_drm_formats), + format_modifiers, + DRM_PLANE_TYPE_PRIMARY, "meson_primary_plane"); + if (ret) { + devm_kfree(priv->drm->dev, meson_plane); + return ret; + } drm_plane_helper_add(plane, &meson_plane_helper_funcs); -- 2.17.1