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: 119084 Delivered-To: patches@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6164912qgn; Thu, 16 Nov 2017 15:00:26 -0800 (PST) X-Received: by 10.99.49.81 with SMTP id x78mr3230241pgx.35.1510873226123; Thu, 16 Nov 2017 15:00:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510873226; cv=none; d=google.com; s=arc-20160816; b=jHkwB8EHmvyRySE7DerpuJesZtwnCxMcxTv6MbWRSdykYGURMIKqzQK2HVDFFOrdaE ERxuK2uMH2m8uFc9XZX3BBU7ObBA+VM8aTci03B4pqufNuxWBLhmUy7mOBzVhjqihg0g qJRmb7GwjmnnUwtkGVBQR2l3lPIhe58AmfJvLwzCQnOOyDbpBdJUmlEemQKaJB6MdW1A OFYerPTd/KDdXAVVKuAqNYA9REAIOnmRLfp/o2gamzZv8YVTat5UTCqiPyeDmFXmmg3Y seVeHjgj0pNWhgdYikEp7SI5iUROSF7VC0IK2h/9za6DJjY7Jw99ZLpmk8lFRWX+sdZb 6NzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=z+Ttt+B2wq/dLUZ4TJt4wz20FA6XdbqcBvXJ2B7UMpU=; b=CRolnJbuMHARLEu75WjZBtbrz22wzecP4JX7t6c+MPd9BZhqNqIBEmNEipIB9kV7Zc fZuGcBIxfzgyD21Xl9jmwbfQ31vSnD/1FN+wAvaY84FJ/KdYPhnlbyayDhxQGFK6T5+9 LoxRz4EftRLa4VJ7v3Yp+B5h8pTFPKirT2JiRTHY+oNVD2sWWfvGN6G/7rCuRKGoVOdn ZePkXIk7fOlCqJi0DdqY6RX/P7Xf6FeWDx9yLZuZtcl5sLExHA59aF+B8HnfGDT51tw6 1AwtZ7n0Pgc8pYElCAcz7MBL1MJ7W5KTwa05Eh6MFUNQyTONUILEKlNAJitTxjrl11nf Ztcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XeS1wXBG; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id p13sor788225pll.138.2017.11.16.15.00.26 for (Google Transport Security); Thu, 16 Nov 2017 15:00:26 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XeS1wXBG; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=MuzRGcMIVEIF1sIC+Z2JkEbGkZIqCRnd57iLaj7H9qG5chBXTpl8ZAxK1QWeK1H0G2 JrTFZyiTK4Ai5h1CUjC/xW/avxz8PDzu+hJMYGQ/glDjJQN7Kh5JngU2bdiofU0uNZAJ eK3EGy3pTfbTS8DMWw21QRp07Ih3U2r7q8nhqIIFYMABQBXN9kuGcERr82UQCkSYgP0R BBMpTQmKMldBgir3rl9Y/ZB6wj69BFnhRlabTVSYLSkznC5Z2z5e295dviWAMybcXpbw 1mZHdfJiZsnBs+V1afA6lgDRgh/ferEXnLmN2bQp1/5j20lgC/bRRBXqnNDy5Nc94fRj AB8Q== X-Gm-Message-State: AJaThX7C0NRZ/etBUMp8bPRA6RzHKCeRRDsMgShPoRUDaHSen9qYHGe5 JaVBD0dxytcouVWw2R/dUajGI6iE 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) Return-Path: 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 Cc: Laurent Pinchart , David Airlie , Lars-Peter Clausen , Bhumika Goyal , Inki Dae , dri-devel@lists.freedesktop.org, lkml , Xinliang Liu , Dan Carpenter , Sean Paul , Hans Verkuil , Archit Taneja , John Stultz 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: 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(-) -- 2.7.4 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;