diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2023-06-14 13:27:43 +0300 |
---|---|---|
committer | Viresh Kumar <viresh.kumar@linaro.org> | 2023-06-19 07:20:02 +0300 |
commit | 84cb7ff35fcf7c0b552f553a3f2db9c3e92fc707 (patch) | |
tree | 491fdd3db54ade951a5664d75f007ab8b98c8639 /drivers/opp/of.c | |
parent | 04bd2eafee153b9cc4b411d4a24d32b1ec2ce41c (diff) | |
download | linux-84cb7ff35fcf7c0b552f553a3f2db9c3e92fc707.tar.xz |
OPP: pstate is only valid for genpd OPP tables
It is not very clear right now that the `pstate` field is only valid for
genpd OPP tables and not consumer tables. And there is no checking for
the same at various places.
Add checks in place to verify that and make it clear to the reader.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Tested-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Diffstat (limited to 'drivers/opp/of.c')
-rw-r--r-- | drivers/opp/of.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 943c7fb7402b..e23ce6e78eb6 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -1392,6 +1392,12 @@ int of_get_required_opp_performance_state(struct device_node *np, int index) goto put_required_np; } + /* The OPP tables must belong to a genpd */ + if (unlikely(!opp_table->is_genpd)) { + pr_err("%s: Performance state is only valid for genpds.\n", __func__); + goto put_required_np; + } + opp = _find_opp_of_np(opp_table, required_np); if (opp) { pstate = opp->pstate; |