From patchwork Mon Jul 30 15:26:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10549225 X-Patchwork-Delegate: agross@codeaurora.org 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 C1FEEA755 for ; Mon, 30 Jul 2018 15:27:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B141A293F3 for ; Mon, 30 Jul 2018 15:27:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A59DF297DE; Mon, 30 Jul 2018 15:27:42 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91442293F3 for ; Mon, 30 Jul 2018 15:27:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726663AbeG3RDJ (ORCPT ); Mon, 30 Jul 2018 13:03:09 -0400 Received: from mail-yw0-f177.google.com ([209.85.161.177]:41435 "EHLO mail-yw0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726634AbeG3RDJ (ORCPT ); Mon, 30 Jul 2018 13:03:09 -0400 Received: by mail-yw0-f177.google.com with SMTP id q129-v6so4500483ywg.8 for ; Mon, 30 Jul 2018 08:27:40 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=29BnNg+33arf3YVU9GWJNNZ9WX6B4oKmFqaQn7yH/nk=; b=hlu+EwO2NoPgEKoqvfnG2KhaDNcIq/cKRwSES/unY76EsCPP9doWTglrlBwj2VL6lk BsXgH5S75jWLweJIUV+IEKaDaj9Va5QQv4f+pJ3WalaDIBwG8pBIwRqv5u/fC8JuI7nu ej2+dZw/dBG5y8LA9ORSwU60A8arwhYKOY1zw= 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:mime-version:content-transfer-encoding; bh=29BnNg+33arf3YVU9GWJNNZ9WX6B4oKmFqaQn7yH/nk=; b=fD4O9+viOB58ihpV1/6TNduNW3t2XRx6SSQc1ibUT9ItZ/AMpsLWIdBETVAh1uhVwN 3n1+aCkSSheonLoU0VakmX8zH0zPb8Wpi7icSaTRBnWrdt3pJ+8fWHIUB2TR7PDmNxpQ cpLB99pWhqGVPflvX/rn1M6jZvXhfR+ofi8fdsWcDRTK9OWBL5a3rqK212R/f0C/TmGX yvZR21Yo+cpr/+wZOrhjOC2Sa6cDXrCtlWdTAVOHUM1jlnXUdIDIGk+GSxha0QeOhKpW 1GGTfpB1CReG4hdY2cY1KR18MbJg0Q7mt+RRAA+emalttypzIMrtmxnHrETaoLOHLZuw AExg== X-Gm-Message-State: AOUpUlGgiQ4/sBpdaOgscaYB18AfhG/m6CLJcp3fZmZMJ+uH5g+MnWxL qBDsYKVvp/70b55IfXtLocFlBw== X-Google-Smtp-Source: AAOMgpef8jWoZ+GaeuGHlTsTSzyxefKUmTrtZ3OEWKKjgWIlNdhEJv6dFmqVExnm0NycnibZXKpoVw== X-Received: by 2002:a0d:f704:: with SMTP id h4-v6mr9029623ywf.240.1532964459666; Mon, 30 Jul 2018 08:27:39 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id s63-v6sm937383ywd.63.2018.07.30.08.27.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 08:27:39 -0700 (PDT) From: Sean Paul To: robdclark@gmail.com, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: dianders@chromium.org, Sean Paul , Archit Taneja , Abhinav Kumar Subject: [PATCH 1/3] drm/msm: dsi: Initialize msm_dsi->id to -1 Date: Mon, 30 Jul 2018 11:26:53 -0400 Message-Id: <20180730152658.157098-2-seanpaul@chromium.org> X-Mailer: git-send-email 2.18.0.345.g5c9ce644c3-goog In-Reply-To: <20180730152658.157098-1-seanpaul@chromium.org> References: <20180730152658.157098-1-seanpaul@chromium.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently msm_dsi->id is initialized to 0 during kzalloc. If bind fails for a secondary dsi device before its id can be properly set (such as during dt parsing), the id will point to the primary dsi device, causing its reference to be removed from dsi_manager's global (msm_dsim_glb) array. This patch initializes the id to -1 and checks for negative in the manager cleanup. Cc: Doug Anderson Signed-off-by: Sean Paul Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/dsi/dsi.c | 1 + drivers/gpu/drm/msm/dsi/dsi_manager.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index ff8164cc6738..ee07d58c2d97 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -83,6 +83,7 @@ static struct msm_dsi *dsi_init(struct platform_device *pdev) return ERR_PTR(-ENOMEM); DBG("dsi probed=%p", msm_dsi); + msm_dsi->id = -1; msm_dsi->pdev = pdev; platform_set_drvdata(pdev, msm_dsi); diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 5224010d90e4..80aa6344185e 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -839,6 +839,8 @@ void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi) if (msm_dsi->host) msm_dsi_host_unregister(msm_dsi->host); - msm_dsim->dsi[msm_dsi->id] = NULL; + + if (msm_dsi->id >= 0) + msm_dsim->dsi[msm_dsi->id] = NULL; } From patchwork Mon Jul 30 15:26:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10549229 X-Patchwork-Delegate: agross@codeaurora.org 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 AA3131751 for ; Mon, 30 Jul 2018 15:28:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A8BF29B2F for ; Mon, 30 Jul 2018 15:28:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8ED6629B44; Mon, 30 Jul 2018 15:28:04 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 389B429B2F for ; Mon, 30 Jul 2018 15:28:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726777AbeG3RDc (ORCPT ); Mon, 30 Jul 2018 13:03:32 -0400 Received: from mail-yw0-f195.google.com ([209.85.161.195]:36679 "EHLO mail-yw0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726743AbeG3RDc (ORCPT ); Mon, 30 Jul 2018 13:03:32 -0400 Received: by mail-yw0-f195.google.com with SMTP id v197-v6so4500646ywg.3 for ; Mon, 30 Jul 2018 08:28:03 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=j4POr+FyfvY6N0WItcaRoSqfe6/JQAhWZIMc05h/GWc=; b=nMfyZhIFAQ57W+eg94D2o5zCjS5mp2moln02bwpPSJFqLB2ZaPhDDqFkkEbzkg1wqS 2yR6Gr611Gc+gTM5I2iguphC3AXSF12lnjehyVuoyuB/d1HrBSe+FuyFttYnGjz8kjQA kU7ENKlFymtXjgN/oNdgW06kQmoxOLslqo8qI= 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:mime-version:content-transfer-encoding; bh=j4POr+FyfvY6N0WItcaRoSqfe6/JQAhWZIMc05h/GWc=; b=CkpOJCGJ3HVoUwF639gelH+6QU9suaQ069o57WeHOmiLkY3hkR72bl4JM8SzaCKSCz pMDzdUAFuAH3Iv+sa2bySm/FXv477bow0B/yRtPFI/9KifKw+iF0ACzDA17dobzyZIq/ ggSO/0OU/fvAkThqPw6hfFaTzPXkW09W3TprO3yVGuLfPJF8sQlL/PzWkECRrAhMiC1O MwJ8i9cqeKQk7F8laTFFuUs+Ku/v45G+bYmayBbnCdSTzA0UXsvz34jKPvhB+Qbh/6Rk +avYorYkA7HKWZha1dtqKPl++8E2yqPdK+xsoim07mJTQI+XUfQJEBXid28LBay71oJ9 goDA== X-Gm-Message-State: AOUpUlEJPLh3S1TCUp8x/vhILl93kU2I9TKkKzOZaqHouZMYyQpEKoZp 5ihEXJOiXC2Pr7x5ANlWH/fA3Q== X-Google-Smtp-Source: AAOMgpfhh1vm/vr9EUkkBz2vKNYPg6N0WOXnqQ5eWym95VWoRNye0YkZzG7o75kAd+AaxfzlBSWp6A== X-Received: by 2002:a0d:e254:: with SMTP id l81-v6mr9220883ywe.220.1532964482806; Mon, 30 Jul 2018 08:28:02 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id s63-v6sm937383ywd.63.2018.07.30.08.28.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 08:28:02 -0700 (PDT) From: Sean Paul To: robdclark@gmail.com, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: dianders@chromium.org, Sean Paul , Archit Taneja , Abhinav Kumar Subject: [PATCH 2/3] drm/msm: dsi: Return errors whan dt parsing fails Date: Mon, 30 Jul 2018 11:26:54 -0400 Message-Id: <20180730152658.157098-3-seanpaul@chromium.org> X-Mailer: git-send-email 2.18.0.345.g5c9ce644c3-goog In-Reply-To: <20180730152658.157098-1-seanpaul@chromium.org> References: <20180730152658.157098-1-seanpaul@chromium.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If dt parsing fails, we should return an error instead of pretending everything completed successfully. Cc: Doug Anderson Signed-off-by: Sean Paul Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 96fb5f635314..9c6c523eacdc 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -1750,6 +1750,7 @@ static int dsi_host_parse_dt(struct msm_dsi_host *msm_host) if (ret) { dev_err(dev, "%s: invalid lane configuration %d\n", __func__, ret); + ret = -EINVAL; goto err; } @@ -1757,6 +1758,7 @@ static int dsi_host_parse_dt(struct msm_dsi_host *msm_host) device_node = of_graph_get_remote_node(np, 1, 0); if (!device_node) { dev_dbg(dev, "%s: no valid device\n", __func__); + ret = -ENODEV; goto err; } From patchwork Mon Jul 30 15:26:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10549231 X-Patchwork-Delegate: agross@codeaurora.org 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 C05C6A755 for ; Mon, 30 Jul 2018 15:28:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B082E29FEA for ; Mon, 30 Jul 2018 15:28:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4C7F29FF2; Mon, 30 Jul 2018 15:28:24 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57D8E29FEA for ; Mon, 30 Jul 2018 15:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726919AbeG3RDv (ORCPT ); Mon, 30 Jul 2018 13:03:51 -0400 Received: from mail-yb0-f196.google.com ([209.85.213.196]:42942 "EHLO mail-yb0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726787AbeG3RDu (ORCPT ); Mon, 30 Jul 2018 13:03:50 -0400 Received: by mail-yb0-f196.google.com with SMTP id c10-v6so4891021ybf.9 for ; Mon, 30 Jul 2018 08:28:21 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=/OlpT6F7XbgfCCcBVmt5ec4be1ZqYvKNni0y9AuUBHQ=; b=aLbRqsSNkjy3Addrs/sKmWuTUhuYmKrzFFePvPY05IB7BJS8JjGE6m1zVa+75k0cCf XMxIu7aSatxV8EVmmQvv6ixGxGrSOPDUH6zVsrerJhINY147cbVtBqs5qv7mY4gOQQHm lWct4CMPzJSPmqJN2aH0GpWOWsVC9rYYut/rA= 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:mime-version:content-transfer-encoding; bh=/OlpT6F7XbgfCCcBVmt5ec4be1ZqYvKNni0y9AuUBHQ=; b=iBCXuUBW7BaQWlcGaQ3E/9WfYxaak9EmmCxrm/EP9SoJgntLcAfPQPZqCUtb0vFp6j ekh176G8sHhQFi0kIv7sVGdFvTp9hJ03/go0WoVvPRUYU/znGawtVCYWYxrNWEzAKMdH pov3LvcmPv6Q+pCgTxj+2huWP+ivxfcUBduzwmKLJ8ncIdJT5XJaGQXNheZQn/Bq9tlN ckhcXKvAmDjXj8wCL6njdAgt4mglmYuK2z1vO4kQZXBGaWH3fEd+j8O2+sbelLQCZd38 nXGddh4Rdn9xqQt+0pgi3W8gSIBC2pj3komhRgRaS95bJBomavIsPINZUNxPmfPFn7cy IS6w== X-Gm-Message-State: AOUpUlGV7y8Syl595Ws0d766QtXdkiwk3HODQsAnRPc8P81pliYuroH3 Y/Mlb7Vtp7H8aDxpOr3qx2q6BQ== X-Google-Smtp-Source: AAOMgpdBriOWX7bgM4iNSufDjihaBxfpQZs2Fu1B1tl37tBz4ivx9q8c5XVQ/3zq7pcyM9WEksGrLQ== X-Received: by 2002:a25:b00a:: with SMTP id q10-v6mr9482567ybf.255.1532964501146; Mon, 30 Jul 2018 08:28:21 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id s63-v6sm937383ywd.63.2018.07.30.08.28.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 08:28:20 -0700 (PDT) From: Sean Paul To: robdclark@gmail.com, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: dianders@chromium.org, Sean Paul , Archit Taneja Subject: [PATCH 3/3] drm/msm: Don't fail bind if nothing connected to dsi Date: Mon, 30 Jul 2018 11:26:55 -0400 Message-Id: <20180730152658.157098-4-seanpaul@chromium.org> X-Mailer: git-send-email 2.18.0.345.g5c9ce644c3-goog In-Reply-To: <20180730152658.157098-1-seanpaul@chromium.org> References: <20180730152658.157098-1-seanpaul@chromium.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If there is no bridge or panel connected to a dsi node, don't fail the entire msm bind. Just ignore the dsi block and move on. Cc: Doug Anderson Signed-off-by: Sean Paul Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/dsi/dsi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index ee07d58c2d97..a9768f823290 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -118,8 +118,13 @@ static int dsi_bind(struct device *dev, struct device *master, void *data) DBG(""); msm_dsi = dsi_init(pdev); - if (IS_ERR(msm_dsi)) - return PTR_ERR(msm_dsi); + if (IS_ERR(msm_dsi)) { + /* Don't fail the bind if the dsi port is not connected */ + if (PTR_ERR(msm_dsi) == -ENODEV) + return 0; + else + return PTR_ERR(msm_dsi); + } priv->dsi[msm_dsi->id] = msm_dsi;