Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753585AbdLMQDr (ORCPT ); Wed, 13 Dec 2017 11:03:47 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36790 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753464AbdLMQDm (ORCPT ); Wed, 13 Dec 2017 11:03:42 -0500 X-Google-Smtp-Source: ACJfBou7hj3rTdNOPRnhBkffliWyZDo3TZvQM1XWUnRS72T0SUGC1iQo+ZViIjyOD/Nj90yVEadW0A== Subject: Re: [PATCH 2/8] drm/sun4i: backend: Allow a NULL plane pointer to retrieve the format To: Maxime Ripard , Daniel Vetter , David Airlie , Chen-Yu Tsai Cc: linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, thomas@vitsch.nl References: <6a1686760e61baa9f21fd2f12e56a8de92eb1714.1513178989.git-series.maxime.ripard@free-electrons.com> From: Neil Armstrong Organization: Baylibre Message-ID: Date: Wed, 13 Dec 2017 17:03:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <6a1686760e61baa9f21fd2f12e56a8de92eb1714.1513178989.git-series.maxime.ripard@free-electrons.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1357 Lines: 33 On 13/12/2017 16:33, Maxime Ripard wrote: > 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. > > 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; > > Reviewed-by: Neil Armstrong