diff options
author | Dmitry Baryshkov <dmitry.baryshkov@linaro.org> | 2020-05-25 18:48:15 +0200 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2020-06-23 21:43:47 +0200 |
commit | e9247e2ce5778678c8d631e26ef79dbccedbe6d0 (patch) | |
tree | 3e0397c5da7caeeb1f013820e0b901561806133f /drivers/soc | |
parent | soc: qcom: socinfo: add support for newer socinfo data (diff) | |
download | linux-e9247e2ce5778678c8d631e26ef79dbccedbe6d0.tar.xz linux-e9247e2ce5778678c8d631e26ef79dbccedbe6d0.zip |
soc: qcom: socinfo: fix printing of pmic_model
Print sensible string instead of just "(null)" for unknown PMIC models.
Also as we are at it, do not let debugfs handler access past pmic_models
array.
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20200525164817.2938638-2-dmitry.baryshkov@linaro.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/soc')
-rw-r--r-- | drivers/soc/qcom/socinfo.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index bb17590c1029..8924269adb16 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -274,7 +274,10 @@ static int qcom_show_pmic_model(struct seq_file *seq, void *p) if (model < 0) return -EINVAL; - seq_printf(seq, "%s\n", pmic_models[model]); + if (model <= ARRAY_SIZE(pmic_models) && pmic_models[model]) + seq_printf(seq, "%s\n", pmic_models[model]); + else + seq_printf(seq, "unknown (%d)\n", model); return 0; } |