From patchwork Mon Oct 2 09:32:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 114567 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp473126qgn; Mon, 2 Oct 2017 02:32:57 -0700 (PDT) X-Received: by 10.84.218.2 with SMTP id q2mr5656958pli.111.1506936777297; Mon, 02 Oct 2017 02:32:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506936777; cv=none; d=google.com; s=arc-20160816; b=WjMHJ4zni769196R16alEOyR0Bsu1VKE2qEkpeiSHzmYpoSoqyrzxBbHft3zIezWAF 5oiXmtgMxLwhYXmhz1muO/9abFOlsWYstUUsXhcx8VYGS4RztQlLNpF5kQ86yvlLOHF1 +iXwhT6peERXY0k8H8Ctafq5wD+CEcH18nCSa+trUKgvD7tFvmrUO2H/q5b4XdgmGW0f 0mDcQUw0n6G3mimYTHWWP2KotipYQJE/IMYOV/tr3Qm/D4mn91FEXXSwcA8fwPBKO/ew xBQeoMlzmSAYc4Vfd2kkWTps9poCo4bdlETYarYJqTMIQUG/SfO+tCvWRLsRCOaNBy4a P3Vw== 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:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=isWHYkrtV5vknIo5Q9wbbd+fBwhKERP8BsmNlsZe1BY=; b=xT3uNHToaijEQTUvJ2r6RJXx8zcvy9/4yIclOawE1vo+qtppiol2WUX5PwtRfzlMgm 6jcI0C6nt86jjqet83cCxevgYyJJrsiFeRrwEPqSr9JryMvBniq++IvlZcnYYn7b5fP1 isbPV8BbZaKJT9schSlOBgcxythUIDxnVXzbqrcBzfyU4W60hQDjR7KHDqlSWTlJqTAw DwVla1YW1nzjYITKjWgB2cZcMg2MHJY/BkOSS2UKnXjtZwHoEs2hwoYnWdElfF2eXeaH h5X+SdKRWbOUI+2E09PAtKyh0C95ji9MYiPcKRzVOUJm01ptz83dME29Av4QI9aqLIGx yD9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=U7DQQgCX; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id h8si5208348pgp.799.2017.10.02.02.32.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Oct 2017 02:32:57 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=U7DQQgCX; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D3FAE6E2E5; Mon, 2 Oct 2017 09:32:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x229.google.com (mail-wr0-x229.google.com [IPv6:2a00:1450:400c:c0c::229]) by gabe.freedesktop.org (Postfix) with ESMTPS id C6E086E2E5 for ; Mon, 2 Oct 2017 09:32:53 +0000 (UTC) Received: by mail-wr0-x229.google.com with SMTP id l39so3429221wrl.12 for ; Mon, 02 Oct 2017 02:32:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FGwwx0p8yLoQ/Wgw+XVB6XyVdxOVWkNkRP1/Mk0nWlw=; b=U7DQQgCXsg0eviLFaIu+XjVczHYnu8msvMibBaPaiFJslFumjNIauKaq+nwATIa83F tzrjlpF88Fozp0MTe5uuQyfX3PVGwqCOMAPXtuXjwAAm6tCF8Xn+4w9bcv9fttD0Ll+k rXe/YVbIqT+xzIxOXmPDlMNlZtelrlcPrnAAs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FGwwx0p8yLoQ/Wgw+XVB6XyVdxOVWkNkRP1/Mk0nWlw=; b=dwV/KTXgELFJdWGR5/MlbPdIlNwbpAcrI/1KTSqIvQocJ4+7OwQqLbzMOI3tYVM5ly 6hjohVjU5ur+a30xZ9oBLtQK5IxJ2BtqFZ045Q3PnS1Gb9YSj/inHsHkq3F8dyvJ2gLY KsCFs2S2gNwQ9SMxXU1lRt2CmSRru/HwxqKj0j3o9zneaihjI4PPpvYI7VseMAsczqBO qhwjfEOaN9XirKNJDw4Dt5XMHuHYmD7SyUxNebWss7TZnvH3/NvIH712ATzKLsCMen27 9bQcYs9I+1Pq7x2D3m0xPiHPCVti5Rr8eJI6khPu2vwk5OBA9gdRiZIko2VfrHphHlii C2Rw== X-Gm-Message-State: AHPjjUjX+WNvwNqgPaz8dsnl9cMZi7yAqWmQpOE7R55V3QQph7RSKVIM bhpg0dKkxO/tC3Tj7D0ABgNKuQ== X-Google-Smtp-Source: AOwi7QAW2LUV9x42XtxV2FuOftZoQjk+zPfLShqxa9Qn06CFs4Bko2+oCKyrzQFShs3tggo0lzahyg== X-Received: by 10.223.139.212 with SMTP id w20mr13180406wra.275.1506936772338; Mon, 02 Oct 2017 02:32:52 -0700 (PDT) Received: from lmecxl0911.lme.st.com ([80.215.199.139]) by smtp.gmail.com with ESMTPSA id 64sm4773434wma.21.2017.10.02.02.32.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Oct 2017 02:32:51 -0700 (PDT) From: Benjamin Gaignard To: architt@codeaurora.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, airlied@linux.ie, daniel.vetter@intel.com, jani.nikula@linux.intel.com, seanpaul@chromium.org, yannick.fertre@st.com, philippe.cornu@st.com Subject: [PATCH v2 1/5] drm/bridge: make drm_panel_bridge_remove more robust Date: Mon, 2 Oct 2017 11:32:31 +0200 Message-Id: <1506936755-23625-2-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506936755-23625-1-git-send-email-benjamin.gaignard@linaro.org> References: <1506936755-23625-1-git-send-email-benjamin.gaignard@linaro.org> Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org 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" Make sure that bridge parameter is not NULL and can be safely cast into a panel_bridge structure. Signed-off-by: Benjamin Gaignard Reviewed-by: Philippe Cornu Tested-by: Philippe Cornu --- drivers/gpu/drm/bridge/panel.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index e0cca19..6d99d4a 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -188,7 +188,15 @@ EXPORT_SYMBOL(drm_panel_bridge_add); */ void drm_panel_bridge_remove(struct drm_bridge *bridge) { - struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge); + struct panel_bridge *panel_bridge; + + if (!bridge) + return; + + if (bridge->funcs != &panel_bridge_bridge_funcs) + return; + + panel_bridge = drm_bridge_to_panel_bridge(bridge); drm_bridge_remove(bridge); devm_kfree(panel_bridge->panel->dev, bridge);