From patchwork Thu Jan 19 10:47:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 92018 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp422019qgi; Thu, 19 Jan 2017 10:47:12 -0800 (PST) X-Received: by 10.98.75.16 with SMTP id y16mr11857517pfa.23.1484851632277; Thu, 19 Jan 2017 10:47:12 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 134si4316027pgh.30.2017.01.19.10.47.12; Thu, 19 Jan 2017 10:47:12 -0800 (PST) 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=neutral (body hash did not verify) header.i=@linaro.org; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754212AbdASSrK (ORCPT + 9 others); Thu, 19 Jan 2017 13:47:10 -0500 Received: from mail-pf0-f180.google.com ([209.85.192.180]:36665 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754283AbdASSrI (ORCPT ); Thu, 19 Jan 2017 13:47:08 -0500 Received: by mail-pf0-f180.google.com with SMTP id 189so15503366pfu.3 for ; Thu, 19 Jan 2017 10:46:51 -0800 (PST) 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=41d7Pg4HF/qT7pXWdrdyT69dtwSPttiU3GC9/4LI5Jg=; b=IDHZLAiXYYFshmdETHTemGeINM4G37kVeB28sW5jTEvWz5DHGk7VIMuUyfpsPRAW1/ 3QWIuOivJF5al6gZTOJHUxJWE6Gh3j9ejbe8QTgQY4Te8JsmErAO/lvuEybDh4BEnRym 3ci2pdN3KyMXIxWDKXS3Nnwu5jRj5mi3yPg3Q= 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=41d7Pg4HF/qT7pXWdrdyT69dtwSPttiU3GC9/4LI5Jg=; b=czolEALMo3JUth9S/i8wjPQtK+Iqo5Wj/Ml4drnmyCQmFFmkwsDDQt1X0KxkSHjB1N pYgC5Bh3ZMC3/FQ2Tt6tBEippEr6g5EXLdVOQQ5Xkyr9rGkLCDHoYj4JZqe/liLlidCm rPSUnamRpArm8MbTkD7D3z3HXutT/34etbYqp5lmC42L52ED3j7WRuQ1RKCOgHAKv4GT zweohnelate4Rez0zwVIi6ELMp7sCjEsHGjcEmgTiS+cRaeoKZdmszPa9PTaWDwzEAxu 90wsvzXugUhH7jXJnXRUbC00bIp6KCdEFjuhXIlaFF33cDtQekdV0h8qAXHqkCEKjZc7 ItLg== X-Gm-Message-State: AIkVDXIGifpzcX4eD1w6qpvGyAPDrlCZ7d94byXaxd6NcxS4xdlhcsWTUI8gp760CLFxEP6i X-Received: by 10.98.63.15 with SMTP id m15mr11877558pfa.71.1484851610902; Thu, 19 Jan 2017 10:46:50 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id w76sm10552990pfd.74.2017.01.19.10.46.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jan 2017 10:46:49 -0800 (PST) From: Bjorn Andersson To: Kishon Vijay Abraham I Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Subhash Jadavani , Vivek Gautam Subject: [PATCH 2/4] phy: qcom-ufs: Correct usage of regulator_get() Date: Thu, 19 Jan 2017 02:47:37 -0800 Message-Id: <20170119104739.4376-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170119104739.4376-1-bjorn.andersson@linaro.org> References: <20170119104739.4376-1-bjorn.andersson@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org When regulator_get() tries to resolve a regulator supply but fail to find a matching property in DeviceTree it returns a dummy regulator, if a matching supply is specified but unavailable the regulator core will return an error. Based on this we should not ignore errors upon failing to acquire the optional "vddp-ref-clk" supply. Cc: Subhash Jadavani Cc: Vivek Gautam Signed-off-by: Bjorn Andersson --- drivers/phy/phy-qcom-ufs.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Vivek Gautam Reviewed-by: Subhash Jadavani diff --git a/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c index 4d7f3c018223..bbd317158084 100644 --- a/drivers/phy/phy-qcom-ufs.c +++ b/drivers/phy/phy-qcom-ufs.c @@ -210,8 +210,9 @@ int ufs_qcom_phy_init_clks(struct ufs_qcom_phy *phy_common) } EXPORT_SYMBOL_GPL(ufs_qcom_phy_init_clks); -static int __ufs_qcom_phy_init_vreg(struct device *dev, - struct ufs_qcom_phy_vreg *vreg, const char *name, bool optional) +static int ufs_qcom_phy_init_vreg(struct device *dev, + struct ufs_qcom_phy_vreg *vreg, + const char *name) { int err = 0; @@ -221,9 +222,7 @@ static int __ufs_qcom_phy_init_vreg(struct device *dev, vreg->reg = devm_regulator_get(dev, name); if (IS_ERR(vreg->reg)) { err = PTR_ERR(vreg->reg); - vreg->reg = NULL; - if (!optional) - dev_err(dev, "failed to get %s, %d\n", name, err); + dev_err(dev, "failed to get %s, %d\n", name, err); goto out; } @@ -263,12 +262,6 @@ static int __ufs_qcom_phy_init_vreg(struct device *dev, return err; } -static int ufs_qcom_phy_init_vreg(struct device *dev, - struct ufs_qcom_phy_vreg *vreg, const char *name) -{ - return __ufs_qcom_phy_init_vreg(dev, vreg, name, false); -} - int ufs_qcom_phy_init_vregulators(struct ufs_qcom_phy *phy_common) { int err; @@ -284,9 +277,9 @@ int ufs_qcom_phy_init_vregulators(struct ufs_qcom_phy *phy_common) if (err) goto out; - /* vddp-ref-clk-* properties are optional */ - __ufs_qcom_phy_init_vreg(phy_common->dev, &phy_common->vddp_ref_clk, - "vddp-ref-clk", true); + err = ufs_qcom_phy_init_vreg(phy_common->dev, &phy_common->vddp_ref_clk, + "vddp-ref-clk"); + out: return err; }