Received: by 10.213.65.68 with SMTP id h4csp1734453imn; Thu, 5 Apr 2018 02:54:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+/o2ZeqLJpQZB5HW8UOXIgTMa1Kwi0q6RBhRhxg195EWWMbPnGbJheSYhl6AYo7jwtVrjE X-Received: by 2002:a17:902:9a82:: with SMTP id w2-v6mr21914877plp.6.1522922091395; Thu, 05 Apr 2018 02:54:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522922091; cv=none; d=google.com; s=arc-20160816; b=qPBquDRo6sS9G2DLKzmZnkO8+w+hUQMCO8xr+nwGUKy4AT6faNRNGC0WwtTv+INK8H fz7PXIyVMfgSPrEUV0QjhTLoa+Q9krX5vG4V2HXC3psv6XrzHKL7pkbJU25JZi4XOEnE mDGx9oPa6fuBKAN2T/TuS12TGBx3KEX6C/m7hFt1nRGcRTxkqrRvmxlTnqSxZaGnLccR 6+3Ka6DM7Ye3icBEBCq73KdyacoEiYsFZ7qhWsR/3uvpCx8+gd90bl7dHuPBgj+bcSUa Rf/++f/mcIpiiLz5C7cBChE22ivViPPbrUTenLucc7bFXc1BBOVKbCUMPFdAjFNhqgDw OOGw== 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:arc-authentication-results; bh=aR/PdzkNPiDygwRJNNkaYGuw1c7dcgtTtAE/qSYX0O0=; b=nE3p3EpX6g/5fBgYk7ppsYeoEJWNsnR44tZ3MwBZJKFXOBMKBIEfh2C3BiL/YTMXXy HOz39W06Zm4GdR+N93vc8mkFfN6dQOpDdChBKBJIu39zFayVJanTlCj/NpZw38VV0suf z+jBcRIJUBdKcLY2Fba1nwL3dWHG79XleBXsCEN0UNGX/BQBBmxSJl2RIdM4TL2w3KKh PHDhnbTJFQzEXyYs//ckefEjAykOq5aaxp4fV/OwAGhnkqnjJS1EuoWc/yi0uwILFSfs UutwwIMxQWdK57hx3ParIWhRyYFudqfCnbVdJqpJN4Db7wayKfR9gAfgQenzhuul8oLW 0Uhw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r2-v6si5628197pli.669.2018.04.05.02.54.37; Thu, 05 Apr 2018 02:54:51 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752210AbeDEJvH (ORCPT + 99 others); Thu, 5 Apr 2018 05:51:07 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:32846 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752051AbeDEJvE (ORCPT ); Thu, 5 Apr 2018 05:51:04 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id F341C277A30 From: Enric Balletbo i Serra To: architt@codeaurora.org, inki.dae@samsung.com, thierry.reding@gmail.com, hjc@rock-chips.com, seanpaul@chromium.org, airlied@linux.ie, tfiga@chromium.org, heiko@sntech.de Cc: dri-devel@lists.freedesktop.org, dianders@chromium.org, a.hajda@samsung.com, ykk@rock-chips.com, kernel@collabora.com, m.szyprowski@samsung.com, linux-samsung-soc@vger.kernel.org, jy0922.shim@samsung.com, rydberg@bitmath.org, krzk@kernel.org, linux-rockchip@lists.infradead.org, kgene@kernel.org, linux-input@vger.kernel.org, orjan.eide@arm.com, wxt@rock-chips.com, jeffy.chen@rock-chips.com, linux-arm-kernel@lists.infradead.org, mark.yao@rock-chips.com, wzz@rock-chips.com, hl@rock-chips.com, jingoohan1@gmail.com, sw0312.kim@samsung.com, linux-kernel@vger.kernel.org, kyungmin.park@samsung.com, Laurent.pinchart@ideasonboard.com, kuankuan.y@gmail.com, hshi@chromium.org, Enric Balletbo i Serra Subject: [PATCH v6 23/30] drm/rockchip: analogix_dp: Do not call Analogix code before bind Date: Thu, 5 Apr 2018 11:49:53 +0200 Message-Id: <20180405095000.9756-24-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180405095000.9756-1-enric.balletbo@collabora.com> References: <20180405095000.9756-1-enric.balletbo@collabora.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tomasz Figa Driver callbacks, such as system suspend or resume can be called any time, specifically they can be called before the component bind callback. Let's use dp->adp pointer as a safeguard and skip calling Analogix entry points if it is an ERR_PTR(). Signed-off-by: Tomasz Figa Signed-off-by: Thierry Escande Signed-off-by: Enric Balletbo i Serra Tested-by: Marek Szyprowski --- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 23317a2269e1..6d45d62466b3 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -368,6 +368,8 @@ static void rockchip_dp_unbind(struct device *dev, struct device *master, analogix_dp_unbind(dp->adp); rockchip_drm_psr_unregister(&dp->encoder); dp->encoder.funcs->destroy(&dp->encoder); + + dp->adp = ERR_PTR(-ENODEV); } static const struct component_ops rockchip_dp_component_ops = { @@ -391,6 +393,7 @@ static int rockchip_dp_probe(struct platform_device *pdev) return -ENOMEM; dp->dev = dev; + dp->adp = ERR_PTR(-ENODEV); dp->plat_data.panel = panel; ret = rockchip_dp_of_probe(dp); @@ -414,6 +417,9 @@ static int rockchip_dp_suspend(struct device *dev) { struct rockchip_dp_device *dp = dev_get_drvdata(dev); + if (IS_ERR(dp->adp)) + return 0; + return analogix_dp_suspend(dp->adp); } @@ -421,6 +427,9 @@ static int rockchip_dp_resume(struct device *dev) { struct rockchip_dp_device *dp = dev_get_drvdata(dev); + if (IS_ERR(dp->adp)) + return 0; + return analogix_dp_resume(dp->adp); } #endif -- 2.16.3