From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: linux-arm-msm@vger.kernel.org, Andy Gross <agross@kernel.org>,
patches@linaro.org, linaro-kernel@lists.linaro.org
Subject: Re: [PATCH 2/4] soc: qcom: socinfo: fix printing of pmic_model
Date: Thu, 28 May 2020 19:37:30 -0700 [thread overview]
Message-ID: <20200529023730.GR279327@builder.lan> (raw)
In-Reply-To: <20200525164817.2938638-2-dmitry.baryshkov@linaro.org>
On Mon 25 May 09:48 PDT 2020, Dmitry Baryshkov wrote:
> 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>
Regards,
Bjorn
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/soc/qcom/socinfo.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c
> index 0e6adf1161c0..41f48c3447cc 100644
> --- a/drivers/soc/qcom/socinfo.c
> +++ b/drivers/soc/qcom/socinfo.c
> @@ -269,7 +269,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;
> }
> --
> 2.26.2
>
next prev parent reply other threads:[~2020-05-29 2:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-25 16:48 [PATCH 1/4] soc: qcom: socinfo: add support for newer socinfo data Dmitry Baryshkov
2020-05-25 16:48 ` [PATCH 2/4] soc: qcom: socinfo: fix printing of pmic_model Dmitry Baryshkov
2020-05-29 2:37 ` Bjorn Andersson [this message]
2020-05-25 16:48 ` [PATCH 3/4] soc: qcom: socinfo: add file with SoC info format version Dmitry Baryshkov
2020-05-29 2:37 ` Bjorn Andersson
2020-05-25 16:48 ` [PATCH 4/4] soc: qcom: socinfo: add SM8250 entry to soc_id array Dmitry Baryshkov
2020-05-29 2:38 ` Bjorn Andersson
2020-05-29 2:35 ` [PATCH 1/4] soc: qcom: socinfo: add support for newer socinfo data Bjorn Andersson
2020-06-22 8:38 ` Dmitry Baryshkov
2020-06-23 19:45 ` Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200529023730.GR279327@builder.lan \
--to=bjorn.andersson@linaro.org \
--cc=agross@kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=patches@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.