mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-26 22:19:23 +07:00
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>
This commit is contained in:
parent
0f12fe7f1e
commit
e9247e2ce5
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user