From patchwork Wed Nov 15 12:37:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10059315 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 5D15C60231 for ; Wed, 15 Nov 2017 12:39:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50EC426E47 for ; Wed, 15 Nov 2017 12:39:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43C8C29F54; Wed, 15 Nov 2017 12:39:27 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 A60D526E47 for ; Wed, 15 Nov 2017 12:39:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DBC596E115; Wed, 15 Nov 2017 12:39:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.134]) by gabe.freedesktop.org (Postfix) with ESMTPS id E61856E115 for ; Wed, 15 Nov 2017 12:39:22 +0000 (UTC) Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.129]) with ESMTPA (Nemesis) id 0Lpijq-1es7GW2LLy-00fT6O; Wed, 15 Nov 2017 13:38:50 +0100 From: Arnd Bergmann To: Archit Taneja Subject: [PATCH] [RFT] drm: adv7511/33: fix adv7511_cec_init() failure handling Date: Wed, 15 Nov 2017 13:37:57 +0100 Message-Id: <20171115123823.1895515-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:DwNn0YZqZ6u14msY07Ar0yNQH5Due18eNTC+YC0xL5odZ/tiqJE mGf8bsXlQ1/BGfLRQNsVQrSB9n16boufgb1x0gKj2eygsVFf+A80ciNbDm83ZkdaS7MYj1m xOlOCjwJYzdtlzrO/0JH3HegN76YE/w19yDachd+tGdYlJ/gBOI1lpwSOUOUaMadwzcvEZf 9ZWWFL9gelcOuNVWgBYuQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:dgkQ7jrUCeg=:u7pymFup0Oh01xrzDGCq3F rGGiWdB3WXWbZumToutGVJ68UgfJrfw/gt4MxDJ6mGJ3hGFFVH3l8VE1HNu/TLNdqCpbyHPlR XC5xvGg5QkUorI2AJLSGfc9ac8NqJk8dwL5SEBIuV5vkb420CU9DUIjmsJeZz+LcYefy7OyE/ UKYLE3+U2LuxhyfCxEER6NHWiUESw9SvZxCO+mhpwfaLVtmtGe5dDWyNIIXvRXCwn99N9HIwj 0Fp4ArgKBWJkAENwb4d/EDrl7XdImwxUrQlYWyZZbqFGRaDB22v3f/3c1h+cBueSuCAiyssd7 dW3oDM0WtOApgt26gp29fPbE5kYs2Lszk/xWOOqBKj7+mm5ufBD04gD7SJwSqtPhSjwHDPnks BaMPVLOL794lyRHTTlUaiWao21JUSw4WufslIc+QINn22/D/iupxhU5D81DZoixgXa+y1kWPp f3T5p+pngvtd4tMIqEX7NxpULmkdNvcj+XsVuD95wEy1AUNu0Iuebj+ZzAOXs1lodMxxCMnJ+ 9HAFrLafYwJFnIZoHU6eV76RXMkku3b/SEtxA+87r11RBFrKmiNGUhANr9OD9wzF/wCrWQPF7 Uvx0LDWEcwkUN+z4NuabQyybvRooMEW/YrVVCOwpp0+9sdwBizVYTtlY8w3yjSGEGEYH+rB5n U6OlyB5uEC7QkC2ISx7jBj0T0tw9h51z7CdKM9+pxGnpx/6TNhD4kUczLmkJI3aKQrunFG98D oy7No/DVBbjcKvduciyPqphVWqjZUWTAtiv5pw== Cc: Bhumika Goyal , Arnd Bergmann , David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Hans Verkuil , Laurent Pinchart , Dan Carpenter 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 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 leave behind any corrupted list entries. This should get the system back to boot but needs testing. From my understanding, there is at least one more bug that needs to be resolved to actually get everything to work again. 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 Tested-by: Naresh Kamboju --- Untested so far, this is what I came up with after reading the WARN_ON log from a modified kernel. Naresh, can you give this one a go? Hans and others, can you review in the meantime? Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 0e14f1572d05..93d1ecafe8fa 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1204,7 +1204,7 @@ 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; + goto err_unregister_bridge; #else regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, ADV7511_CEC_CTRL_POWER_DOWN); @@ -1212,6 +1212,11 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id) return 0; +#ifdef CONFIG_DRM_I2C_ADV7511_CEC +err_unregister_bridge: + adv7511_audio_exit(adv7511); + drm_bridge_remove(&adv7511->bridge); +#endif err_unregister_cec: i2c_unregister_device(adv7511->i2c_cec); if (adv7511->cec_clk)