From patchwork Fri Sep 29 12:59:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 114517 Delivered-To: patch@linaro.org Received: by 10.80.163.150 with SMTP id s22csp798161edb; Fri, 29 Sep 2017 05:59:39 -0700 (PDT) X-Received: by 10.84.238.201 with SMTP id l9mr6705911pln.159.1506689979361; Fri, 29 Sep 2017 05:59:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506689979; cv=none; d=google.com; s=arc-20160816; b=t2G+RKZ9g/FrSjG5CL7Hz1K0XYkeHr90EUarKfbuIh4RcckmKMdot8C50iIFZJczrz 4tUc1GslplvW8S9C6bGQMvtBXKF2NlyLPkUjyrzMesLhfwb2NkMAJSzOFl3+w+ujlQed +ZpqatJwLj8wShGkrSLRszSFxq/GTdRXa9Cuez4pdf7IhSzeXCWv9Gq1DGQtpuItPcPY vp0aytX8T4smX0APEV+nhX1+sFj7JNsZsFUd+asvMMi/VtmMBCO7vB0/JaGNEgzDUogi nTQBRXdFNJYiqLLGfnhgBahXh3HLzeX5WjPH8g3TsLHiP0K4B5ACvmIma67HyzyZmccL EmFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=+6qTWk2NQHqkPJUR4egv7WzZ0oLeBPdJGWCoL/5D6Tw=; b=KuK6x2NAI1lJrdgmsRe2W3ySDzCtNQZREtYRhTRtSWQByZqqoPdXp4uVfZT28iFW3F omj+Gr/EhVhf7DJ+NDJlzdFtB/AeaohxkNhyut3nIkSUPmuSbFamZDafANjz5Dpc53No RK5oS2hXew3Q5LrqL23m2HycYPxrdaN15jRrwTIhOK3SY+KFjx59vx1IvysFh4Kdqa+N NapvyDLTGE0kW+uwfXINZqRLhVPms+UhRZHYyQL7ob8Sq77XgpR9kG5+HP2oNlwsihGl ASv989NoUfDmtnviWOLX3xYFZa94lN29WAp3jjUrZUZMZ0z7oYP5EoqXBpjYgjfz7jm7 8/Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IKt5Jr7j; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j185si68092pgc.543.2017.09.29.05.59.39; Fri, 29 Sep 2017 05:59:39 -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=@linaro.org header.s=google header.b=IKt5Jr7j; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752123AbdI2M7g (ORCPT + 26 others); Fri, 29 Sep 2017 08:59:36 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:48759 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751224AbdI2M7e (ORCPT ); Fri, 29 Sep 2017 08:59:34 -0400 Received: by mail-wm0-f51.google.com with SMTP id m127so3225850wmm.3 for ; Fri, 29 Sep 2017 05:59:33 -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=+6qTWk2NQHqkPJUR4egv7WzZ0oLeBPdJGWCoL/5D6Tw=; b=IKt5Jr7jQIVrUD4KGoRo2lDM6SCgWcMosXVwBzFx2M5p/wss/Q4OlNgZxHMQfDmhfd KiayiNOLQQ9fnkB60q9HhZUcUKL135SKMdfzteMp9yOOL1/jArPePnq35mso+WrqYp8H O7n3Y+dEISs7me+pkOZq8wWUwmLcYReovgcqE= 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=+6qTWk2NQHqkPJUR4egv7WzZ0oLeBPdJGWCoL/5D6Tw=; b=ry1HDvT3OC0bt86vHAfF6PtJkmrCtAxD08HpvfvvFV1K+PoM8H1yJ3i5Umqz8aK+zq LT70s87xPMyigHNPbr8/gjeRZUTC8TjxDtWYD6+NQh7SPJqj6oVGMpEIB3Bq9gp1OvSQ RIZCVCza/253V14zVminGe4J3GvdfVs7ix3t73Vv1eDiKbWCIasifojZci8ojCrbmMg8 uGftToAZHXqDlAgVlEDBNVqeXqJg+sSXkym9MV43lGAdZQ+s01FjSI/fr46H4RLewP4t ZDteHuMF2hOOyvyy2t4kOx+IozydSQCcytYXsnSuTo4D9DIglb1OFXPZucYx1jhBiTPf J5GA== X-Gm-Message-State: AHPjjUiQfiYlx80aDKChgt235jZyMg6vKK7nFeViG+7m8RtV37uhgzcD QB3HiKMBmM5jRJVlh5Ogwscu0A== X-Google-Smtp-Source: AOwi7QDESy5y8I6ddDl0HbbclKxo22GAEamNZ5l03A/yR94jBcOdaOZoYdxJdGipwpPbngFOJHe6wA== X-Received: by 10.28.63.145 with SMTP id m139mr4496254wma.5.1506689972620; Fri, 29 Sep 2017 05:59:32 -0700 (PDT) Received: from lmecxl0911.lme.st.com ([80.215.91.35]) by smtp.gmail.com with ESMTPSA id k11sm3269667wrc.90.2017.09.29.05.59.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Sep 2017 05:59:32 -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 Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Benjamin Gaignard Subject: [PATCH 1/3] drm/bridge: make drm_panel_bridge_remove more robust Date: Fri, 29 Sep 2017 14:59:17 +0200 Message-Id: <1506689959-7858-2-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506689959-7858-1-git-send-email-benjamin.gaignard@linaro.org> References: <1506689959-7858-1-git-send-email-benjamin.gaignard@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make sure that bridge parameter is not NULL and can be safely cast into a panel_bridge structure. Signed-off-by: Benjamin Gaignard --- drivers/gpu/drm/bridge/panel.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.7.4 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);