Received: by 10.192.165.148 with SMTP id m20csp1042249imm; Wed, 2 May 2018 13:04:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrLV+cUbumdyxwaQVqtdAPJd8vK/lpFpIq59E9pWCSHdIyB26NC1YS/dxydIZrq1DHly+3g X-Received: by 2002:a17:902:108a:: with SMTP id c10-v6mr21912964pla.111.1525291472192; Wed, 02 May 2018 13:04:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525291472; cv=none; d=google.com; s=arc-20160816; b=q/k5n1Qn80BMvACXV2qkrEtW0S0vZtBO/kLT4GD1bz6MBw4iiLkcM8N1faQxeIMhwf /Nnzy8D80F4YUH7OjCFNHmR3bTQeVlyGuQ4nHL+okq7QVliUZFN0RU/JTyj3f1T4Hd2H j24PHq9MXXbmDITetZgojV6rZE3h9IzwxVRkdtyvrQhKAvlH1A365ekV5zRW1GM/dZ/w ljcDhIcdHrsAiotm8RNvsKygR1X/EkzbRsA1KW5IGFIMUCFHv02JVJzC3w4a4sMW5I7S qEGKdYijtWRQvrQIYDq+kuEZQzTFExHlCNorAIUSQ9kcAxjUa1n+rlFW5fzOshcx0IbM b4iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=WCihXI0kHrRjPCP+Cfosr4axdolvKKuXv8q6HunSGlo=; b=NY9V3LvjIKfE5iR/7m0Anydgbp3gGZ6LuRV0OcA+7apFkGmz3yQI69ZzrI+CRzqy7J mOMIZa1JFue2lNG7gxaujnRYjfYOtCFhQ1PZGXKdszG1OII2Cjcfl76FoSar0tXMYZNJ JpXR6iRqKgVYOaLvxtKgW57KIt+cfuva5Rn0gDSx94cCp8BpNmlSmCSMRyt5RQ1MeQfF 9FCg6IHOrSh4cH2H0H9DWhor8C3eLJhk089ISO/cw00Q74R5eoY570mlsvhnIa22GFTK JQm1Yc0x8YdqmrYGi1qpzUOZFZZ0IBfjmOOZycXzTo1yi1WA+ePli3rHaa6D5h7EpXQc vSBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=X4k5jRh3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l12-v6si11985459plc.545.2018.05.02.13.04.17; Wed, 02 May 2018 13:04:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=X4k5jRh3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751390AbeEBUD7 (ORCPT + 99 others); Wed, 2 May 2018 16:03:59 -0400 Received: from mail-yw0-f194.google.com ([209.85.161.194]:35969 "EHLO mail-yw0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751075AbeEBUD4 (ORCPT ); Wed, 2 May 2018 16:03:56 -0400 Received: by mail-yw0-f194.google.com with SMTP id l15-v6so4971920ywk.3 for ; Wed, 02 May 2018 13:03:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WCihXI0kHrRjPCP+Cfosr4axdolvKKuXv8q6HunSGlo=; b=X4k5jRh3dT8cBgTR7usY49EuKgrvhW1C3GjEjFsNQ2HPGCX5L6pdSmIJ4g6k9I1zUs 2sNsvFYgmt9n/ydQqgyXsbO6jy03GNRal7Q5a+r0G5vzrGfFh0XpXctPDvMjhaX+OdKm Y2dWz0mCWBSein8ihSNWmT2mEAc89mMvNstjA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WCihXI0kHrRjPCP+Cfosr4axdolvKKuXv8q6HunSGlo=; b=terfnJ5y5bGD3YVdTYRwp6V9YOX3rnWydD+DXFLJv3shkp4Quvs5nUROtah4FnHkq1 7HspzQ9IuTNq7jlnKQW3zCj85A8dIPlt2tKCwlH5wmzNN1cK74rq1yIgP9d4oSxegqgV MAL2pUOw6qFxs/OX6coLJXZYUMZpjzDTEPprZRgxNNUn9sffP8vw0VP4H5N0uF1AkANo 0mkihLDbzinn3dphXP2ZmV6MuV85eJPJKHGCc0d9AT8Kd7Dv39KpzOPeslcHz+di8TIW I04kjg6XjgqAWlTiUfFnFPPOTYkwu1vFriWvRYsYZyvmKsynv4xTCqqDdBZDHjZCPAun oFqQ== X-Gm-Message-State: ALQs6tBCluwRqFH1s9yvscMvOL8/9tQ6w5431SMzhn2SE+gSgB3JHRE2 zQB6LZ4mauuOVaGveLQQAbiwew== X-Received: by 2002:a81:68d6:: with SMTP id d205-v6mr12099427ywc.287.1525291436034; Wed, 02 May 2018 13:03:56 -0700 (PDT) Received: from localhost ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id l1-v6sm5441813ywh.62.2018.05.02.13.03.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 May 2018 13:03:55 -0700 (PDT) Date: Wed, 2 May 2018 16:03:54 -0400 From: Sean Paul To: Eric Anholt Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Boris Brezillon Subject: Re: [PATCH] drm/vc4: Fix oops dereferencing DPI's connector since panel_bridge. Message-ID: <20180502200354.GU73214@art_vandelay> References: <20180309233256.1667-1-eric@anholt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180309233256.1667-1-eric@anholt.net> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 09, 2018 at 03:32:56PM -0800, Eric Anholt wrote: > In the cleanup, I didn't notice that we needed to dereference the > connector for the bus_format. Fix the regression by looking up the > first (and only) connector attached to us, and assume that its > bus_format is what we want. Some day it would be good to have that > part of display_info attached to the bridge, instead. > > Signed-off-by: Eric Anholt > Fixes: 7b1298e05310 ("drm/vc4: Switch DPI to using the panel-bridge helper.") > Cc: Boris Brezillon > --- > drivers/gpu/drm/vc4/vc4_dpi.c | 27 +++++++++++++++++++++++---- > 1 file changed, 23 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c > index 72c9dbd81d7f..88783e143cc2 100644 > --- a/drivers/gpu/drm/vc4/vc4_dpi.c > +++ b/drivers/gpu/drm/vc4/vc4_dpi.c > @@ -96,7 +96,6 @@ struct vc4_dpi { > struct platform_device *pdev; > > struct drm_encoder *encoder; > - struct drm_connector *connector; > > void __iomem *regs; > > @@ -164,14 +163,31 @@ static void vc4_dpi_encoder_disable(struct drm_encoder *encoder) > > static void vc4_dpi_encoder_enable(struct drm_encoder *encoder) > { > + struct drm_device *dev = encoder->dev; > struct drm_display_mode *mode = &encoder->crtc->mode; > struct vc4_dpi_encoder *vc4_encoder = to_vc4_dpi_encoder(encoder); > struct vc4_dpi *dpi = vc4_encoder->dpi; > + struct drm_connector_list_iter conn_iter; > + struct drm_connector *connector = NULL, *connector_scan; > u32 dpi_c = DPI_ENABLE | DPI_OUTPUT_ENABLE_MODE; > int ret; > > - if (dpi->connector->display_info.num_bus_formats) { > - u32 bus_format = dpi->connector->display_info.bus_formats[0]; > + /* Look up the connector attached to DPI so we can get the > + * bus_format. Ideally the bridge would tell us the > + * bus_format we want, but it doesn't yet, so assume that it's > + * uniform throughout the bridge chain. > + */ > + drm_connector_list_iter_begin(dev, &conn_iter); > + drm_for_each_connector_iter(connector_scan, &conn_iter) { > + if (connector_scan->encoder == encoder) { > + connector = connector_scan; > + break; > + } > + } > + drm_connector_list_iter_end(&conn_iter); > + > + if (connector && connector->display_info.num_bus_formats) { > + u32 bus_format = connector->display_info.bus_formats[0]; > > switch (bus_format) { > case MEDIA_BUS_FMT_RGB888_1X24: > @@ -199,6 +215,9 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder) > DRM_ERROR("Unknown media bus format %d\n", bus_format); > break; > } > + } else { > + /* Default to 24bit if no connector found. */ > + dpi_c |= VC4_SET_FIELD(DPI_FORMAT_24BIT_888_RGB, DPI_FORMAT); > } > > if (mode->flags & DRM_MODE_FLAG_NHSYNC) > @@ -264,7 +283,7 @@ static int vc4_dpi_init_bridge(struct vc4_dpi *dpi) > return ret; > } > > - if (panel) > + if (panel) whitespace creep, with that fixed: Reviewed-by: Sean Paul > bridge = drm_panel_bridge_add(panel, DRM_MODE_CONNECTOR_DPI); > > return drm_bridge_attach(dpi->encoder, bridge, NULL); > -- > 2.16.2 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Sean Paul, Software Engineer, Google / Chromium OS