From patchwork Mon Jun 17 12:51:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 167015 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2823499ilk; Mon, 17 Jun 2019 05:51:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXR786vyzB/xZeBo/KRZjr6ZAkymNKuZw8LBGbajRzGleJJZgKATZbne9+lY3LR5g1fQpR X-Received: by 2002:aa7:8f24:: with SMTP id y4mr70081552pfr.36.1560775872706; Mon, 17 Jun 2019 05:51:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560775872; cv=none; d=google.com; s=arc-20160816; b=LbnXdYrS5PFoVfb+EoOIQgRKXySBSrw4by2XtOfl7m0xVP6td3g2PD4PQGQ+rHJfzB Il69fxRqtHnkKbdX12myyLdk9m84BpY4/M04gvBrELnYp7xJRZPN0kMBeRmKNHoBUBKn IepnVfvNYd8br4INuJIox8wbsI2RxNqw5daTTccvKVp5lmNuVuCgEJ2PlaCrIB5Ct+cU P89ZRWQ2D1lLiI4CiYvSB92S+P0GXJ8Q67ekWjFiuPI91OSErMNQ+wQM7VfjKkIpH8U3 p6VnKi8vZDyEYoLtA4cBLXUsOpIc/yrDD+vf63F73342HTJ2+QRMT9HYw8KjFwTRc4nN 4Wsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=2zuxNNJ4iuFL5CUgXXBK/C8GK/Wfm+gcHDg2NkvAFB8=; b=d5mWlWGt4bMePeoq01rvj6slAepb6wMOZl8hUuMlToW8/Bhuyf+eSXU+/Xv0EiJG09 wx+wfawb1+iszER4b80D2mHzLR6UTJOqaNI/Pksea1J7FfB5wKin411CcQ2u83b8Obow cOuQTZP9+gBymBBlT/09AP1fxbRBBk0q3ya1tvhMU5wgEHQK0JGJWRXYIaS5b3sYkq49 mTZtmuE55GyxRVeek0rH2S2TtIcdosc+M4/lFx3Fg+FJkGwPs+NPK7OhYo0jSh+uTgjP LBXKItOQMjNs2V/AFhgtno/HAx+l7wZaVjdfhezKj0622CBlf3LtM43fNXblnEVJi5Jw +BUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="q+s/96q0"; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f20si1163727pfn.166.2019.06.17.05.51.12; Mon, 17 Jun 2019 05:51:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="q+s/96q0"; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727876AbfFQMvL (ORCPT + 15 others); Mon, 17 Jun 2019 08:51:11 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:32805 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727465AbfFQMvL (ORCPT ); Mon, 17 Jun 2019 08:51:11 -0400 Received: by mail-wr1-f66.google.com with SMTP id n9so9855448wru.0 for ; Mon, 17 Jun 2019 05:51:10 -0700 (PDT) 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=2zuxNNJ4iuFL5CUgXXBK/C8GK/Wfm+gcHDg2NkvAFB8=; b=q+s/96q0GvL81bpISKq1BYq2qgGMpiINLYY94rSfeJIBgtJ0JASEtiXtDPecNFmtZL IVM+FA8aky8PBmnMLL4+Kt0aJ3tCYdUb9UEdfNN6lMqZIm32xgDsGAGZEN75E5BGglZ5 O0qHpPxDxjps+O6mgY7ewWjzgrArHawuVqm5pgALhFmzbvj/vTigwdNoWTRq+QYjzbQW X4PP0kzs+r42vn1y/uQP2HCx+p4e6qaylctjsm4b3GGzN1UOWC+lSwN5UNNB59hZ9phn mt8/uuVdLmFh2bLj3JPXGKXcTYEITepZw7iCLKx8El0VEXOnDiwDYGwUZY8bVg2fGUtk a2Ig== 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=2zuxNNJ4iuFL5CUgXXBK/C8GK/Wfm+gcHDg2NkvAFB8=; b=W6RNzXq8dYr1twDLnrASagMF8jlqFbPYfc4B7urs9kNuy8T+yNAgX0EVsxbYiPRPrP /vpOknnUdEyIJKKdAsKi2YCOExblY5oB0YBaQssDfiAmfI5XygVGzfW1SPtfUKjHumez Bvuo7Mc0yGeR4OhqUm7cKplxw18AqHD7YHYHJypEV1jEJWEm1hMCiA77sYsr4CoBb2V8 bCxH2oa7SnJ5d9gc+lYg5acKxFusQaf/NR86/61aFZSLIF83Lc/cXt3V/Ffv3r02Kdbh LC0X1pJxpwee/H/55z5inDZOg04UtcXzdfnEztvOKBLLZQPyRD+nN8Pm5S+e/j9yaLAZ VOew== X-Gm-Message-State: APjAAAWQ0RoBN4OoaTGB8Stkigu2SClPY/YH20NNPN7Q/BizTU7UINPn 5IMtPQJBnVj7xvfcvktZEJAOWg== X-Received: by 2002:a5d:6050:: with SMTP id j16mr6799737wrt.20.1560775869586; Mon, 17 Jun 2019 05:51:09 -0700 (PDT) Received: from dell.watershed.co.uk ([2.27.35.243]) by smtp.gmail.com with ESMTPSA id o11sm10477852wmh.37.2019.06.17.05.51.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 05:51:09 -0700 (PDT) From: Lee Jones To: alokc@codeaurora.org, agross@kernel.org, david.brown@linaro.org, bjorn.andersson@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org, ard.biesheuvel@linaro.org, jlhugo@gmail.com, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, felipe.balbi@linux.intel.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Lee Jones Subject: [RESEND v4 1/4] soc: qcom: geni: Add support for ACPI Date: Mon, 17 Jun 2019 13:51:02 +0100 Message-Id: <20190617125105.6186-2-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190617125105.6186-1-lee.jones@linaro.org> References: <20190617125105.6186-1-lee.jones@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org When booting with ACPI as the active set of configuration tables, all; clocks, regulators, pin functions ect are expected to be at their ideal values/levels/rates, thus the associated frameworks are unavailable. Ensure calls to these APIs are shielded when ACPI is enabled. Signed-off-by: Lee Jones Acked-by: Ard Biesheuvel --- drivers/soc/qcom/qcom-geni-se.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c index 6b8ef01472e9..d5cf953b4337 100644 --- a/drivers/soc/qcom/qcom-geni-se.c +++ b/drivers/soc/qcom/qcom-geni-se.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. +#include #include #include #include @@ -450,6 +451,9 @@ int geni_se_resources_off(struct geni_se *se) { int ret; + if (has_acpi_companion(se->dev)) + return 0; + ret = pinctrl_pm_select_sleep_state(se->dev); if (ret) return ret; @@ -487,6 +491,9 @@ int geni_se_resources_on(struct geni_se *se) { int ret; + if (has_acpi_companion(se->dev)) + return 0; + ret = geni_se_clks_on(se); if (ret) return ret; @@ -724,12 +731,14 @@ static int geni_se_probe(struct platform_device *pdev) if (IS_ERR(wrapper->base)) return PTR_ERR(wrapper->base); - wrapper->ahb_clks[0].id = "m-ahb"; - wrapper->ahb_clks[1].id = "s-ahb"; - ret = devm_clk_bulk_get(dev, NUM_AHB_CLKS, wrapper->ahb_clks); - if (ret) { - dev_err(dev, "Err getting AHB clks %d\n", ret); - return ret; + if (!has_acpi_companion(&pdev->dev)) { + wrapper->ahb_clks[0].id = "m-ahb"; + wrapper->ahb_clks[1].id = "s-ahb"; + ret = devm_clk_bulk_get(dev, NUM_AHB_CLKS, wrapper->ahb_clks); + if (ret) { + dev_err(dev, "Err getting AHB clks %d\n", ret); + return ret; + } } dev_set_drvdata(dev, wrapper); From patchwork Mon Jun 17 12:51:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 167017 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2823625ilk; Mon, 17 Jun 2019 05:51:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyky+MnURwP88dH/FNnj1COi3TX1ir81HJRBYydYbEuAkxHhVUb4t+NK01Ujq1zBjIIp0tl X-Received: by 2002:a65:534b:: with SMTP id w11mr606432pgr.210.1560775879826; Mon, 17 Jun 2019 05:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560775879; cv=none; d=google.com; s=arc-20160816; b=rKsTV6eN+Xc+156h2HP07e21Ze+ABErEEyePEwfbbrfU5VKnRAdSAOjPgGNycBxyFF +XZSM2clKPrzoouzJRq3+gkk9nJjLIvo+BR8KnWYX9J/QmncSqREDJZpWJoCFlRVNj8L A35gxp+Xc+2qSJTm5tmw8h/VhwinV2ytQ19TSy5DYbEadXiimw5hZ+EoxNKTI9Oxkfhv WTNz3vNiL/Nzom5JVbvMEZe41qPUDu7NSSohhQS4Lhhu9yDP7SS0eEZK4bmgAPFW2CcK em2FGkLIyJDU/Syb49qsZhPmOZHWNrZ+rS+aW7ebaL0q77pLz/t0VO+oSTIvR7whRoAN CUKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Yh8KWN22mWMhTl8rcvEzBYBWJNOHxR/ZVbPRRDE/D+g=; b=PQ3FMNLgRZ7DQTw0aQaZ9whAuH10jhbf9CN/hkMIqyPLH9VEJUmGQszBNuRYR/Pw8B 2sSz2hrpa3g8jL497oKGRuvuuLWQnNhCDE4HOsirlGLr8041jO5Y743dt0DfwFEPONlp 7rhVfXImEe90er5nGgq9A09+lpRcqe/fka194BsGFqz7n+RBbJhjsuThxSHk+LzTxxaD l/Xbx4t4pE8lD2tyTiv3wZbhsggRnsMssjSSKUiowCMNqU4E6VzaSS0G9yncZ7uJPbY6 NCbgH9v5FxxkXxwouBCB1b4CiNkQk2pA0+X423dMaDSFnH6H/kpSpTuZsb9np+M3T8dO s+ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="q/VQwMJ7"; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si10295268pfa.74.2019.06.17.05.51.19; Mon, 17 Jun 2019 05:51:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="q/VQwMJ7"; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726834AbfFQMvP (ORCPT + 15 others); Mon, 17 Jun 2019 08:51:15 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:50278 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727916AbfFQMvO (ORCPT ); Mon, 17 Jun 2019 08:51:14 -0400 Received: by mail-wm1-f66.google.com with SMTP id c66so9150623wmf.0 for ; Mon, 17 Jun 2019 05:51:13 -0700 (PDT) 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=Yh8KWN22mWMhTl8rcvEzBYBWJNOHxR/ZVbPRRDE/D+g=; b=q/VQwMJ7CaCCS2TpiY40tB9SR/0BGYUD9cg5QmvyZlgN0oSe9DGo/a+8W3tFnih/es f/TGbxw2+NhrkghexAa4OElVuqj6adr3zChACFmOr55PBTOD/M1NIEdtp5/IEy9qU/kC fX2Qrs7PhDGqUidNClIWZ04Lwg4RW4iXSfsUN/mQ3Fz6ReP9i0AdV914a9optyVwxJ9W Xy6Y1mSeoVn1NeqGDQGLUT+gzK0PwP6QYlI5aEiS1G795pxPRN55vGKPX1Kr7l+p8xwx 9xxVx3Oo0mrnM/HpISh/Sd3kMq4WHV1BoTnn1nr+LgaU5NktIDT5p1PPAhig5lYx1wqZ dRuw== 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=Yh8KWN22mWMhTl8rcvEzBYBWJNOHxR/ZVbPRRDE/D+g=; b=mqr/jhM9XGd+l6Cun+utMIe4yZuhUP7g8AcOezx80qOR8fqsJav8Bifbsk21upsPdn AxOC68n8v/iECoAK/dVJJutgl26MW1IWK7sBeQysT9LaOnlUtN0dMQ+jwYp6/Onxdw0b jTV0wJ0sq2Ajrx0kW597j8VO4vdbNF2hZtSJkNKnOGQ7gcsFtAH5gakUwSIwqKsELPvN Bb7hsoXDufZa08DcMiRNa2XAMdNVkBk7TKwHTJiqupgrvJASKk7hLNfyeeBFTP/oaEhl CPiu9MsozESfvulG7gVoajogRK603c46x0NvPVEn0tfzX0i3ReotzXnddF3B8dr96z9F 3AmA== X-Gm-Message-State: APjAAAUR4tRjRWY8E1BiD268gXAGp24syo79dvELFyAQ6/3bN7M+d48K +c/li0i9RDfb6Cg4zN1nSTiGUA== X-Received: by 2002:a1c:63c4:: with SMTP id x187mr17953607wmb.4.1560775872645; Mon, 17 Jun 2019 05:51:12 -0700 (PDT) Received: from dell.watershed.co.uk ([2.27.35.243]) by smtp.gmail.com with ESMTPSA id o11sm10477852wmh.37.2019.06.17.05.51.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 05:51:12 -0700 (PDT) From: Lee Jones To: alokc@codeaurora.org, agross@kernel.org, david.brown@linaro.org, bjorn.andersson@linaro.org, balbi@kernel.org, gregkh@linuxfoundation.org, ard.biesheuvel@linaro.org, jlhugo@gmail.com, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, felipe.balbi@linux.intel.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Lee Jones Subject: [RESEND v4 4/4] usb: dwc3: qcom: Improve error handling Date: Mon, 17 Jun 2019 13:51:05 +0100 Message-Id: <20190617125105.6186-5-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190617125105.6186-1-lee.jones@linaro.org> References: <20190617125105.6186-1-lee.jones@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org dwc3_qcom_clk_init() is called with of_count_phandle_with_args() as an argument. If of_count_phandle_with_args() returns an error, the number of clocks will be a negative value and will lead to undefined behaviour. Ensure we check for an error before attempting to blindly use the value. Signed-off-by: Lee Jones Reviewed-by: Bjorn Andersson --- drivers/usb/dwc3/dwc3-qcom.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 2d050303d564..c59e9d8e8609 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -409,6 +409,9 @@ static int dwc3_qcom_clk_init(struct dwc3_qcom *qcom, int count) if (!np || !count) return 0; + if (count < 0) + return count; + qcom->num_clocks = count; qcom->clks = devm_kcalloc(dev, qcom->num_clocks,