Commit e9247e2c authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Bjorn Andersson

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: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20200525164817.2938638-2-dmitry.baryshkov@linaro.orgSigned-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent 0f12fe7f
...@@ -274,7 +274,10 @@ static int qcom_show_pmic_model(struct seq_file *seq, void *p) ...@@ -274,7 +274,10 @@ static int qcom_show_pmic_model(struct seq_file *seq, void *p)
if (model < 0) if (model < 0)
return -EINVAL; return -EINVAL;
if (model <= ARRAY_SIZE(pmic_models) && pmic_models[model])
seq_printf(seq, "%s\n", pmic_models[model]); seq_printf(seq, "%s\n", pmic_models[model]);
else
seq_printf(seq, "unknown (%d)\n", model);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment