Skip to content

Commit

Permalink
OPP: The level field is always of unsigned int type
Browse files Browse the repository at this point in the history
[ Upstream commit ba36747 ]

By mistake, dev_pm_opp_find_level_floor() used the level parameter as
unsigned long instead of unsigned int. Fix it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
vireshk authored and gregkh committed Feb 5, 2024
1 parent f6d6e9c commit 5f93c49
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions drivers/opp/core.c
Expand Up @@ -832,9 +832,14 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_ceil);
* use.
*/
struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev,
unsigned long *level)
unsigned int *level)
{
return _find_key_floor(dev, level, 0, true, _read_level, NULL);
unsigned long temp = *level;
struct dev_pm_opp *opp;

opp = _find_key_floor(dev, &temp, 0, true, _read_level, NULL);
*level = temp;
return opp;
}
EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_floor);

Expand Down
4 changes: 2 additions & 2 deletions include/linux/pm_opp.h
Expand Up @@ -157,7 +157,7 @@ struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev,
unsigned int *level);

struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev,
unsigned long *level);
unsigned int *level);

struct dev_pm_opp *dev_pm_opp_find_bw_ceil(struct device *dev,
unsigned int *bw, int index);
Expand Down Expand Up @@ -324,7 +324,7 @@ static inline struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev,
}

static inline struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev,
unsigned long *level)
unsigned int *level)
{
return ERR_PTR(-EOPNOTSUPP);
}
Expand Down

0 comments on commit 5f93c49

Please sign in to comment.