From patchwork Sun Apr 17 05:25:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 8862401 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 81CE1BF29F for ; Sun, 17 Apr 2016 05:25:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B106F201CE for ; Sun, 17 Apr 2016 05:25:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DDBBA201BC for ; Sun, 17 Apr 2016 05:25:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F0AD06E03D; Sun, 17 Apr 2016 05:24:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kmu-office.ch (mail.kmu-office.ch [IPv6:2a02:418:6a02::a2]) by gabe.freedesktop.org (Postfix) with ESMTPS id C4F066E03D for ; Sun, 17 Apr 2016 05:24:57 +0000 (UTC) Received: from localhost.localdomain (unknown [IPv6:2601:602:8f02:dcfc:3e97:eff:fe92:db3b]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 8D1F25C0ED0; Sun, 17 Apr 2016 07:23:24 +0200 (CEST) From: Stefan Agner To: dri-devel@lists.freedesktop.org, stefan@agner.ch Subject: [PATCH 2/6] drm/fsl-dcu: handle missing panel gracefully Date: Sat, 16 Apr 2016 22:25:51 -0700 Message-Id: <1460870755-22964-3-git-send-email-stefan@agner.ch> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1460870755-22964-1-git-send-email-stefan@agner.ch> References: <1460870755-22964-1-git-send-email-stefan@agner.ch> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1460870606; bh=O0jLcm8yX291ndejrFyR8M21HwefT3pSqxm0UIDYXmQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=DCl0cdGM8fsWXPgvhIgaouwRLMHIpygzIZm5Q4G4mvRWeUx9GB5s8sZBfiBRnQF6hNDn70YBPtaV54+CHhMf0oaoXaEIt52nEsPYStQVGHjzprRH+sHRAOv8jN2gDj9U/kkOrDybrwojsc0fyCh3tR/Ljwi5rBFzmlk38a6LT0M= Cc: jianwei.wang.chn@gmail.com, meng.yi@nxp.com, alison.wang@freescale.com, linux-kernel@vger.kernel.org, alexander.stein@systec-electronic.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" X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If the device tree property fsl,panel is missing, drm_panel_attach is called with a NULL pointer as first argument. Having a panel is basically mandatory since RGB is the only supported connector. Check if a panel node has been found, return -ENODEV and cleanup otherwise. Signed-off-by: Stefan Agner --- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c index a07886f..819fe12 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c @@ -171,14 +171,18 @@ int fsl_dcu_drm_connector_create(struct fsl_dcu_drm_device *fsl_dev, DRM_MODE_DPMS_OFF); panel_node = of_parse_phandle(fsl_dev->np, "fsl,panel", 0); - if (panel_node) { - fsl_dev->connector.panel = of_drm_find_panel(panel_node); - if (!fsl_dev->connector.panel) { - ret = -EPROBE_DEFER; - goto err_sysfs; - } - of_node_put(panel_node); + if (!panel_node) { + dev_err(fsl_dev->dev, "fsl,panel property not found\n"); + ret = -ENODEV; + goto err_sysfs; + } + + fsl_dev->connector.panel = of_drm_find_panel(panel_node); + if (!fsl_dev->connector.panel) { + ret = -EPROBE_DEFER; + goto err_panel; } + of_node_put(panel_node); ret = drm_panel_attach(fsl_dev->connector.panel, connector); if (ret) { @@ -188,6 +192,8 @@ int fsl_dcu_drm_connector_create(struct fsl_dcu_drm_device *fsl_dev, return 0; +err_panel: + of_node_put(panel_node); err_sysfs: drm_connector_unregister(connector); err_cleanup: