From patchwork Mon Jun 10 17:52:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10985269 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EAC5B14BB for ; Mon, 10 Jun 2019 17:52:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D46E62852B for ; Mon, 10 Jun 2019 17:52:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7ABD2873D; Mon, 10 Jun 2019 17:52:56 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6E75B2852B for ; Mon, 10 Jun 2019 17:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=WgpTlwj3HYEJIjecuoThYGsW/XZNsiQ/UZ0+WGIK6EU=; b=uAEbbWBVuchqrx 6cIZpkVFTsb+/EjQF6GYWx01jBZFEdG1qqdzSoW6jWKZaXPa9zXYEzGXKoGIjG/PdykQX0ToRb0Db slch7H6cgTeBkjzoba4hlr6V5Qc2tImTnTCOvfcRHO+KebKIHlvuSXJAGulfWJyuvsuedrz2V3hGV S1JPyGJAuWTtXly7yb11MWgun6um/nmfIJyuP2knvtao93on21KjzcLn+fNKAvFOUEYPsvSSavHvA u/eCKdC/dKjO/6bIV06P5AmUbQxwK2adMQg3Wa1l21TpftQKjpZMMiekDGRyhKHLfXDH0HPV7ePgd Ijw+sKlFT3i8eGgy+f2A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1haOTU-00074w-WC; Mon, 10 Jun 2019 17:52:53 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1haOTS-00074c-3a for linux-rockchip@lists.infradead.org; Mon, 10 Jun 2019 17:52:51 +0000 Received: by mail-pf1-x444.google.com with SMTP id d126so5741584pfd.2 for ; Mon, 10 Jun 2019 10:52:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=e+j33U/KoRlNgTFzxm2+JBRTgicwoY0lYBd07TSgrA8=; b=cxF1nMuo6dYPyZe7IW550Tuvt/62sqAH3zxqkBDBP60Zvf09/H9NyJ84Hes67AMcs+ FT0mKqC866kkF5lMJa9TjElrohQWwc7L7NecmxSE5p/88FgBlI315lwC72hDmcLD12FS La1s9o0nVajzrUxY6540kLZ1wY50dWzDdtCIg= 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:mime-version :content-transfer-encoding; bh=e+j33U/KoRlNgTFzxm2+JBRTgicwoY0lYBd07TSgrA8=; b=qQcH35q/8n7/0W0mVPhxW9Dp66Fk366QJRgDTE3XS2m2MAlsTG39jTb/20ARyq1DKl 7dAFmAVv8DOriylZbcvq+NpH6ZwmSUvT0/qjIiDtQmmvKol+VbYUodBNdKcRLcVr6Nu6 +hh0PYprXcIImpg6w37LKY+hcCaHJA5bPNw3Ne/O4UjtMSa0pDIUnaLRIHUzNXX+vher R82G5uhayLDK6muu2OoYLdhdGoNLLZIhnYDjsY1iv/xjx1iyTFzp8hWXOY1rs5fPrEd0 /BeIzwhb3q81AyORI5VXIfl7ah9qa83UlTS/Q+tNLlkPJ+/NQUxfeX6hLZbrHi+GJ4+4 oEfg== X-Gm-Message-State: APjAAAWCo9n1S4JTMlvpF/PiFOGdGul6XZUTyffBYezWhtsTuPV0jP/F 8tl49eNB0XCHRoG5fTAnC9PyDw== X-Google-Smtp-Source: APXvYqzU1Wm58XzoJcqWjPmPcWmK6k9fe25HmAb+1sgysyHkY4qvbyB6DYlP3+BcnzlJSNDd0YA7aA== X-Received: by 2002:a17:90a:e397:: with SMTP id b23mr22154592pjz.140.1560189169114; Mon, 10 Jun 2019 10:52:49 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id o192sm12247158pgo.74.2019.06.10.10.52.48 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 10 Jun 2019 10:52:48 -0700 (PDT) From: Douglas Anderson To: Sean Paul Subject: [PATCH] drm/bridge/synopsys: dw-hdmi: Fix unwedge crash when no pinctrl entries Date: Mon, 10 Jun 2019 10:52:34 -0700 Message-Id: <20190610175234.196844-1-dianders@chromium.org> X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190610_105250_180272_3B196DCF X-CRM114-Status: GOOD ( 10.46 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heiko@sntech.de, Andrzej Hajda , David Airlie , Jonas Karlman , Douglas Anderson , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Neil Armstrong , linux-rockchip@lists.infradead.org, Laurent Pinchart , Daniel Vetter , Thomas Gleixner , Sam Ravnborg , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Erico Nunes Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In commit 50f9495efe30 ("drm/bridge/synopsys: dw-hdmi: Add "unwedge" for ddc bus") I stupidly used IS_ERR() to check for whether we have an "unwedge" pinctrl state even though on most flows through the driver the unwedge state will just be NULL. Fix it so that we consistently use NULL for no unwedge state. Fixes: 50f9495efe30 ("drm/bridge/synopsys: dw-hdmi: Add "unwedge" for ddc bus") Reported-by: Erico Nunes Signed-off-by: Douglas Anderson --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index f25e091b93c5..5e4e9408d00f 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -251,7 +251,7 @@ static void dw_hdmi_i2c_init(struct dw_hdmi *hdmi) static bool dw_hdmi_i2c_unwedge(struct dw_hdmi *hdmi) { /* If no unwedge state then give up */ - if (IS_ERR(hdmi->unwedge_state)) + if (!hdmi->unwedge_state) return false; dev_info(hdmi->dev, "Attempting to unwedge stuck i2c bus\n"); @@ -2686,11 +2686,13 @@ __dw_hdmi_probe(struct platform_device *pdev, hdmi->default_state = pinctrl_lookup_state(hdmi->pinctrl, "default"); - if (IS_ERR(hdmi->default_state) && - !IS_ERR(hdmi->unwedge_state)) { - dev_warn(dev, - "Unwedge requires default pinctrl\n"); - hdmi->unwedge_state = ERR_PTR(-ENODEV); + if (IS_ERR(hdmi->default_state) || + IS_ERR(hdmi->unwedge_state)) { + if (!IS_ERR(hdmi->unwedge_state)) + dev_warn(dev, + "Unwedge requires default pinctrl\n"); + hdmi->default_state = NULL; + hdmi->unwedge_state = NULL; } }