From patchwork Tue Jan 9 10:09:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123848 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp266158edr; Tue, 9 Jan 2018 02:09:46 -0800 (PST) X-Google-Smtp-Source: ACJfBovOFljYn7CcHjTs0Kb70Yaz9TpRJ3vlthM0o5WXfFHNOT6d2PHdUHpOTfGW4KdjA+O23fLp X-Received: by 10.99.116.23 with SMTP id p23mr6855608pgc.60.1515492586777; Tue, 09 Jan 2018 02:09:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515492586; cv=none; d=google.com; s=arc-20160816; b=CXeJ25BC2tE6qMl1JicEIF4/Do6ZlocEh44S8EgxAbqvicPcPVMsYFJYkOZVkj3DoE ZPjyNppcMO/WQuiAkhKxFQnt6+AsVL7N0Uk96ZGM3tl8+m0X/pCIYALXS+kJcccEV5oy QpPk6KrRmM3tTZkPBalYRfT8ko1Yi5yLNXlABdZJfCrdOHKV1XSjYuuxDy3MOpGcxuBJ NfsY6YplZgdKuufBS1UuNstHSA3QWXKnjUW8SdzXyDX/70epTwMWU3kNPaDvY3HPUTnv zUMKe129+SfpRz97JBrMC0Ye+iaBAXMaecMDChL1VzA2FKX/WEN1yUW1YSIHUctgDxPf tijw== 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=GSA4eNME9PiIJjRHmCBb8biv9s2Y9LJwZbfJhdfD3NvJMazmY1f2Dub8VRFbOQQSqt 8lHF0dGuWbbgTUNqfnVSxwcbUU1oHlIQm4cL0DwHPXiQUGpva8q44WWrz8sBXDwS5io6 0eSAHFDtgZAXJWwhhr6avvN6e25LVRb2MjZmq/2mD5m6RvAxeEODq0JEJ0rIgyuvMaUV VPu++hLyQ8O8/umH6FXdt59g+hvqLy3Z+ehTMZg2GIEfiKmIIxPgI/IrDm3mHy35HcJm HmcwmJD96pSdTY9kEqcTkzVf/+AJR99ER+5Zzv6Yxg4LXEsI9gffVtrSdhXasdTHSxIK h+cw== 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 x10si2604296pff.290.2018.01.09.02.09.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:09:46 -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 54F426E0B8; Tue, 9 Jan 2018 10:09:43 +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 8AD4589F71 for ; Tue, 9 Jan 2018 10:09:41 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 0DCBE2046F; Tue, 9 Jan 2018 11:09: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 D66F42064F; Tue, 9 Jan 2018 11:09:29 +0100 (CET) From: Maxime Ripard To: Daniel Vetter , David Airlie , Chen-Yu Tsai , Maxime Ripard Subject: [PATCH v3 03/13] drm/sun4i: backend: Allow a NULL plane pointer to retrieve the format Date: Tue, 9 Jan 2018 11:09:16 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Thomas Petazzoni , narmstrong@baylibre.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, thomas@vitsch.nl 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;