[<prev] [next>] [day] [month] [year] [list]
Message-Id: <51b7d5dec3d4f3a677b355b12fac9dcac63828cf.1701155328.git.viresh.kumar@linaro.org>
Date: Tue, 28 Nov 2023 12:39:06 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Viresh Kumar <vireshk@...nel.org>, Nishanth Menon <nm@...com>,
Stephen Boyd <sboyd@...nel.org>,
Ulf Hansson <ulf.hansson@...aro.org>
Cc: Viresh Kumar <viresh.kumar@...aro.org>, linux-pm@...r.kernel.org,
Vincent Guittot <vincent.guittot@...aro.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Dan Carpenter <dan.carpenter@...aro.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH] OPP: Check for invalid OPP in dev_pm_opp_find_level_ceil()
_find_key_ceil() may return an error and that must be checked before
passing the same to dev_pm_opp_put().
Fixes: 41907aa4ae37 ("OPP: Level zero is valid")
Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
---
drivers/opp/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 4f1ca84d9ed0..c022d548067d 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -808,6 +808,8 @@ struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev,
struct dev_pm_opp *opp;
opp = _find_key_ceil(dev, &temp, 0, true, _read_level, NULL);
+ if (IS_ERR(opp))
+ return opp;
/* False match */
if (temp == OPP_LEVEL_UNSET) {
--
2.31.1.272.g89b43f80a514
Powered by blists - more mailing lists