From d7c9c59b7134f093cf3f829832f4f7771a65664e Mon Sep 17 00:00:00 2001 From: "Ivan T. Ivanov" Date: Tue, 15 Sep 2015 09:43:10 +0300 Subject: [PATCH] mfd: qcom-spmi-pmic: Do not access non existing registers Cc: linux-kernel@vger.kernel.org Revision ID registers are available only on devices with Slave ID Zero, so don't make access to unavailable registers. Signed-off-by: Ivan T. Ivanov --- drivers/mfd/qcom-spmi-pmic.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c index af6ac1c4b45c..d7ad72af5682 100644 --- a/drivers/mfd/qcom-spmi-pmic.c +++ b/drivers/mfd/qcom-spmi-pmic.c @@ -122,12 +122,22 @@ static int pmic_spmi_probe(struct spmi_device *sdev) { struct device_node *root = sdev->dev.of_node; struct regmap *regmap; + u32 sid; + int ret; + + ret = of_property_read_u32(root, "reg", &sid); + if (ret < 0) { + dev_err(&sdev->dev, "Missing SID\n"); + return ret; + } regmap = devm_regmap_init_spmi_ext(sdev, &spmi_regmap_config); if (IS_ERR(regmap)) return PTR_ERR(regmap); - pmic_spmi_show_revid(regmap, &sdev->dev); + /* Only devices with Slave ID Zero contain this information */ + if (sid == 0) + pmic_spmi_show_revid(regmap, &sdev->dev); return of_platform_populate(root, NULL, NULL, &sdev->dev); } -- 1.9.1