From patchwork Fri Mar 3 08:09:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 9602167 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E4A07602B4 for ; Fri, 3 Mar 2017 08:16:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6FC928616 for ; Fri, 3 Mar 2017 08:16:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB8B62861A; Fri, 3 Mar 2017 08:16:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F317E28616 for ; Fri, 3 Mar 2017 08:16:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751408AbdCCIPz (ORCPT ); Fri, 3 Mar 2017 03:15:55 -0500 Received: from slow1-d.mail.gandi.net ([217.70.178.86]:59580 "EHLO slow1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751250AbdCCIPz (ORCPT ); Fri, 3 Mar 2017 03:15:55 -0500 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by slow1-d.mail.gandi.net (Postfix) with ESMTP id AC765486533 for ; Fri, 3 Mar 2017 09:10:45 +0100 (CET) Received: from w540.lan (unknown [IPv6:2001:b07:6442:1ac4:74b8:3be2:ba43:32cb]) (Authenticated sender: jacopo@jmondi.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 9C016A80CF; Fri, 3 Mar 2017 09:09:42 +0100 (CET) From: Jacopo Mondi To: laurent.pinchart@ideasonboard.com Cc: dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH] drm: rcar-du: Make sure DRM planes are created by VSP1 Date: Fri, 3 Mar 2017 09:09:38 +0100 Message-Id: <1488528578-26978-1-git-send-email-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.7.4 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Gen3 platforms compositing planes are allocated by VSP on behalf of DRM/KMS. If VSP support is not compiled in, vsp1 initialization stub routine is called, leading to invalid memory accesses later on when un-initialized planes are accessed. Fail explicitly earlier if planes are not properly created. Signed-off-by: Jacopo Mondi --- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index b5d3f16..7f56c09 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -616,6 +616,9 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu) ret = rcar_du_vsp_init(vsp); if (ret < 0) return ret; + + if (!vsp->planes) + return -EINVAL; } }