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: 118942 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4259557qgn; Wed, 15 Nov 2017 04:39:26 -0800 (PST) X-Google-Smtp-Source: AGs4zMb0g/FL7I/pGTLBPAKs2O/66Yq0tTpr1QvDJNK4gom+E8bfFpGr8jqNeWSPIeBgHucTcCNy X-Received: by 10.99.67.195 with SMTP id q186mr14925768pga.186.1510749566289; Wed, 15 Nov 2017 04:39:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510749566; cv=none; d=google.com; s=arc-20160816; b=lJ7ZRl6+BekKkHibaISzd/k4GWOMNQiQTAujrJtBDVjUk/IiB6/2lMbXBAGWQAQGD0 tUo7AwLXVdm3rKLPrtv0VMzgvTgQPY6n3b3DuWwP5EXsFSih0c5eVuW9q8bSmHOmr2S8 QKeYP2TvcvdQ0BiB96UB2pDd8GWrKDdTdlC/0b+cKUJ/QKkcYUvJf3PmtjA+cH/eJDZ6 JtWHCR5FEe3+BlNPGDTiHDR+Vr59ShX/dQTdxqy3FdB6BdTjMdkLnCN/AImOinC1pPIK Jn/HCgviKASKQH49Z8+oNbVuD4Q6m+w4nKwH1OExBuWhPp9qWkoc2wHZzmgxiWsnQw6c JZag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=V9iSAoicWo5Qc8QDyQdNjIQG4IlGZTwcqnzQcNSzJwg=; b=mOvU89zKl7Of/hbryjOAqIy+7uDfL2/Nmzpw7+BbLIio1epdMnAPNfuGQ4XOxb1Hew Auy8gy3UDOh3zOnGkS45j+Pcpj8crw6WkbTnoeQQiCnF6mYQL+2FRfTBoDyNFSi8By4p OK98dT6rfxuiBibYBzD8LWsQjGJfZF3cPYidn88XETQayDgdSXwtfXE6KeJkl460vG4s VUnu67oU6GAGa3pMUdfqmsxvQIJDRkvgCcKK/yNPp9rqVZiFyTxaTAUSiHOv6p+gVSSP yJq/h1aaM/J97D9CjZFzcVCNVUfRQa/EY//9p7TOIj8X2nVEBWzLYqZsdn3kJlMvsw3M 3fQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id f68si17216008pgc.400.2017.11.15.04.39.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 04:39:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org 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" 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 --- 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)