From patchwork Mon Jan 22 09:25:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125359 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1054006ljf; Mon, 22 Jan 2018 01:26:25 -0800 (PST) X-Google-Smtp-Source: AH8x227l/KYvTYH+kWgMLuV12eUGsN54TiRg9WEsTV00cZEViuOgxh8AepIOJxwL4Rxm1IM1M7cX X-Received: by 10.99.60.13 with SMTP id j13mr6726526pga.306.1516613185312; Mon, 22 Jan 2018 01:26:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516613185; cv=none; d=google.com; s=arc-20160816; b=cW4MxijAzFo4s2Pl31OlouU4EQGOYfCnTeDdR8Q2ky+DkNnmaP1TlHFIO1/M1cfOgD A+6mI5/ayPzxAqpl+OtRaKVL6fHbG5zBL3rUxr+2IfJV3QM2QZwVhHnJ4JdAdcECDK2Q y4Fh1a7Co1DowXXw5CAsIhJh2QXdm+sEtpQmXQqzqUOazhQujZPFktiGXiifFWgahF0v 2a1vubo03frrDF+yE8buX7BR4GGv7GCDecnZYfFN0oFrFof6xXgkLZpmEO/NtMGorKDd yCxs7bkZBkvyKlncO98C2t7ZI8GQYBXGnKePDY9ayPOCRH9hGL+JQkKw3tA1rJz1zEm2 TB3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:references:in-reply-to :message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=eFsEpKppMOXYUixwq7KVJEtfd6kjwMOSfW0PAadZ4Bo=; b=I1rGLCzKw1/CNzZxS0pKLF4AKmZYyW6zmq2+D8+BK9giQVvjmf1slSeXjWjzni23xj kSGwTIC+9vhI6uK8bbx8vdKLJErPwNGQs8/xjI6Nw6VokssbqUjbminshBptgJB/TLZa H0zmiIMhIgjIZwRUI3ZcxazOpy8tjNGBGo17o6W5IlCHo02/Sv6mcwjSc/a46AbsNR3X NXO+LNbhVniHqn06z2O4G6cw96oqa6EPINIAfzR1pENpFgTIG1Mybp518rltTSMV0WhY GGbwKAjpy7v5X7ahpz1phN9tWGFP+iyLuC3ULxQgc/yZo/GoLd/czH/Uju7lQm7ZhGUu 7DJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 196si13498413pfv.261.2018.01.22.01.26.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jan 2018 01:26:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) 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 8BD0E6E194; Mon, 22 Jan 2018 09:25:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id 4CEBA6E0C6 for ; Mon, 22 Jan 2018 09:25:41 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id AD61C206F0; Mon, 22 Jan 2018 10:25:40 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 7AF7B206F1; Mon, 22 Jan 2018 10:25:30 +0100 (CET) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard Subject: [PATCH v4 03/13] drm/sun4i: backend: Allow a NULL plane pointer to retrieve the format Date: Mon, 22 Jan 2018 10:25:17 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: linux-arm-kernel@lists.infradead.org, thomas@vitsch.nl, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, narmstrong@baylibre.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The function converting the DRM format to its equivalent in the backend registers was assuming that we were having a plane. However, we might want to use that function when setting up a plane using the frontend, in which case we will not have a plane associated to the backend's layer. Yet, we still need to setup the format to the one output by the frontend. Test for NULL plane pointers before referencing them, so that we can work around it. Reviewed-by: Neil Armstrong Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index c99d1a7e815a..f971d3fb5ee4 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c @@ -93,7 +93,7 @@ void sun4i_backend_layer_enable(struct sun4i_backend *backend, static int sun4i_backend_drm_format_to_layer(struct drm_plane *plane, u32 format, u32 *mode) { - if ((plane->type == DRM_PLANE_TYPE_PRIMARY) && + if (plane && (plane->type == DRM_PLANE_TYPE_PRIMARY) && (format == DRM_FORMAT_ARGB8888)) format = DRM_FORMAT_XRGB8888;