From patchwork Thu Nov 16 22:59:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10062171 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 271A46023A for ; Thu, 16 Nov 2017 23:00:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18AF12AC0A for ; Thu, 16 Nov 2017 23:00:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C3B32AC40; Thu, 16 Nov 2017 23:00:30 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6F32B2AC0A for ; Thu, 16 Nov 2017 23:00:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 83C546E01B; Thu, 16 Nov 2017 23:00:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3CEBC6E01B for ; Thu, 16 Nov 2017 23:00:26 +0000 (UTC) Received: by mail-pf0-x243.google.com with SMTP id b6so454376pff.10 for ; Thu, 16 Nov 2017 15:00:26 -0800 (PST) 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=z+Ttt+B2wq/dLUZ4TJt4wz20FA6XdbqcBvXJ2B7UMpU=; b=XeS1wXBG2OO5USHflh2x3v++7jRn92B/zrgvYrbc4zukT4C3RNGPyC64NluB9IKqBl EcJ7fgiQFNoE3fqD241DeNZzPkNBcbY8u51tOOPmTJGd9vV5idpn2UjV3yJmEQAGCp5h 8dW/Bzg/9XPgz1afkLUlOspvvNih09q1WhWoA= 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=z+Ttt+B2wq/dLUZ4TJt4wz20FA6XdbqcBvXJ2B7UMpU=; b=WjF8SKx8RD1+r/Vw71jOESY4TfjWT6j9GfLOAJzKVdrXZipuW3P+IIXXIhwYhSARkk ljwqiJjGt41/OoTFmL8hK7wzVUdmbjYn0N4aEI1S2qAJtU/Pn5wpFFf0tPgtUsRjnc/x x5S2d4V5MB2l6xD0HYC/ojAsPzC4+pUWtUZGt1Bo1iiu4Af/p0xiI+0lQE7IWy2CGX0o YjGCxdGHqb601EalbEU+DVAW8JlwXJAwxXrFgMZI0XI5OymCCvvNDbdUTCWtQOZJVrtD PmsG7xKCCLJoJalYsHOlTTAtbXhOdY+18Ki19mLrHNu5MKMlKhb83goxXZPPn3gckPAW yQ5A== X-Gm-Message-State: AJaThX7x+pekwVdNmxv/g350KAx8JQ7LSAV3AfFw+O/DGrhLbzDeDXc2 fVULLFggzuAVWNLkZsRSVCwhtA== X-Google-Smtp-Source: AGs4zMYdEJ9/TaZsqQJAN8HXDqIfnhWzaXyxCYTBdBdUKZpc1OP5npanmDHDc3qBi2hSz/41JIvmMw== X-Received: by 10.84.240.196 with SMTP id l4mr3194596plt.149.1510873225436; Thu, 16 Nov 2017 15:00:25 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id m25sm5077700pfg.49.2017.11.16.15.00.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Nov 2017 15:00:23 -0800 (PST) From: John Stultz To: Arnd Bergmann Subject: [RFC][PATCH] drm: adv7511/33: Fix adv7511_cec_init() failure handling Date: Thu, 16 Nov 2017 14:59:39 -0800 Message-Id: <1510873179-20786-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Cc: David Airlie , lkml , dri-devel@lists.freedesktop.org, Laurent Pinchart , Hans Verkuil , Dan Carpenter , Bhumika Goyal 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-Virus-Scanned: ClamAV using ClamSMTP From: Arnd Bergmann An otherwise correct cleanup patch from Dan Carpenter turned a broken failure handling from a feature patch by Hans Verkuil into a kernel Oops, so bisection points to commit 7af35b0addbc ("drm/kirin: Checking for IS_ERR() instead of NULL") rather than 3b1b975003e4 ("drm: adv7511/33: add HDMI CEC support"). I've managed to piece together several partial problems, though I'm still struggling with the bigger picture: adv7511_probe() registers a drm_bridge structure that was allocated with devm_kzalloc(). It calls adv7511_cec_init(), which fails for an unknown reason, which in turn triggers the registered structure to be removed. Elsewhere, kirin_drm_platform_probe() gets called, which calls of_graph_get_remote_node(), and that returns NULL. Before Dan's patch we would go on with a NULL pointer here and register that, now kirin_drm_platform_probe() fails with -ENODEV. In a third driver, dsi_parse_dt() calls drm_of_find_panel_or_bridge(), which after not finding a panel goes on to call of_drm_find_bridge(), and that crashes due to the earlier list corruption. This addresses the first issue by making sure that adv7511_probe() does not completely fail when the adv7511_cec_init() function fails, and instead we just disable the CEC feature. This avoids having the driver entirely fail to load if just the CEC initialization fails. Reported-by: Naresh Kamboju Cc: Xinliang Liu Cc: Dan Carpenter Cc: Sean Paul Cc: Hans Verkuil Cc: Archit Taneja Link: https://bugs.linaro.org/show_bug.cgi?id=3345 Link: https://lkft.validation.linaro.org/scheduler/job/48017#L3551 Fixes: 7af35b0addbc ("drm/kirin: Checking for IS_ERR() instead of NULL") Fixes: 3b1b975003e4 ("drm: adv7511/33: add HDMI CEC support") Signed-off-by: Arnd Bergmann [jstultz: Reworked so when adv7511_cec_init() fails, we disable the feature instead of disabling the entire driver, which causes graphics to not funciton] Signed-off-by: John Stultz --- Just wanted to send out my rework of Arnd's patch here. Feedback would be welcome. thanks -john drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 0e14f15..939c3b9 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1203,12 +1203,12 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id) #ifdef CONFIG_DRM_I2C_ADV7511_CEC ret = adv7511_cec_init(dev, adv7511, offset); - if (ret) - goto err_unregister_cec; #else - regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, - ADV7511_CEC_CTRL_POWER_DOWN); + ret = 1; #endif + if (ret) + regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, + ADV7511_CEC_CTRL_POWER_DOWN); return 0;