From patchwork Wed Nov 18 00:06:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 56905 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp2250940lbb; Tue, 17 Nov 2015 16:06:49 -0800 (PST) X-Received: by 10.66.148.67 with SMTP id tq3mr67772849pab.124.1447805209153; Tue, 17 Nov 2015 16:06:49 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sa8si34066pbb.131.2015.11.17.16.06.48; Tue, 17 Nov 2015 16:06:49 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754166AbbKRAGs (ORCPT + 6 others); Tue, 17 Nov 2015 19:06:48 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:42750 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751388AbbKRAGr (ORCPT ); Tue, 17 Nov 2015 19:06:47 -0500 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id E050713F369; Wed, 18 Nov 2015 00:06:46 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id D273F13F382; Wed, 18 Nov 2015 00:06:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-caf-smtp.dmz.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1 Received: from sboyd-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: sboyd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4D14B13F369; Wed, 18 Nov 2015 00:06:46 +0000 (UTC) From: Stephen Boyd To: Lee Jones Cc: "Ivan T. Ivanov" , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] mfd: qcom-spmi-pmic: Don't access non-existing registers Date: Tue, 17 Nov 2015 16:06:44 -0800 Message-Id: <1447805204-32483-1-git-send-email-sboyd@codeaurora.org> X-Mailer: git-send-email 2.6.3.369.g91ad409 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: "Ivan T. Ivanov" Revision ID registers are available only on devices with Slave IDs that are even, so don't make access to unavailable registers. Signed-off-by: Ivan T. Ivanov [sboyd@codeaurora.org: Consider all slave ids that are even] Signed-off-by: Stephen Boyd --- drivers/mfd/qcom-spmi-pmic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- 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 diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c index af6ac1c4b45c..8653e8b9bb4f 100644 --- a/drivers/mfd/qcom-spmi-pmic.c +++ b/drivers/mfd/qcom-spmi-pmic.c @@ -127,7 +127,9 @@ static int pmic_spmi_probe(struct spmi_device *sdev) if (IS_ERR(regmap)) return PTR_ERR(regmap); - pmic_spmi_show_revid(regmap, &sdev->dev); + /* Only the first slave id for a PMIC contains this information */ + if (sdev->usid % 2 == 0) + pmic_spmi_show_revid(regmap, &sdev->dev); return of_platform_populate(root, NULL, NULL, &sdev->dev); }