Skip to contentSkip to conversation

OPP: Return correct value in dev_pm_opp_get_level

PATCH Applied Aleks Todorov 2 participants 2 messages Jan 23 – Jan 27 Operating performance points (OPP)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OPP: Return correct value in dev_pm_opp_get_level

Commit 073d3d2ca7d4 ("OPP: Level zero is valid") modified the documentation for this function to indicate that errors should return a non-zero value to avoid colliding with the OPP level zero, however forgot to actually update the return.

No in-tree kernel code depends on the error value being 0.

Fixes 073d3d2ca7d4 ("OPP: Level zero is valid")
---
 drivers/opp/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/opp/core.c +1 -1
index dbebb8c829bc..ae43c656f108 100644
@@ -241,7 +241,7 @@ unsigned int dev_pm_opp_get_level(struct dev_pm_opp *opp)
 {
 	if (IS_ERR_OR_NULL(opp) || !opp->available) {
 		pr_err("%s: Invalid parameters\n", __func__);
-		return 0;
+		return U32_MAX;
 	}
 
 	return opp->level;
Signature · 1 line
2.52.0.457.g6b5491de43-goog
Applied
#1 lore raw
Quoted 18 lines · Aleks Todorov

Commit 073d3d2ca7d4 ("OPP: Level zero is valid") modified the documentation for this function to indicate that errors should return a non-zero value to avoid colliding with the OPP level zero, however forgot to actually update the return.

No in-tree kernel code depends on the error value being 0.

Fixes 073d3d2ca7d4 ("OPP: Level zero is valid")
---
 drivers/opp/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/opp/core.c +0 -0
index dbebb8c829bc..ae43c656f108 100644

drivers/opp/core.c unsigned int dev_pm_opp_get_level(struct dev_pm_opp *opp) · line 247

Quoted 8 lines
drivers/opp/core.c +1 -1
@@ -241,7 +241,7 @@ unsigned int dev_pm_opp_get_level(struct dev_pm_opp *opp)
 {
 	if (IS_ERR_OR_NULL(opp) || !opp->available) {
 		pr_err("%s: Invalid parameters\n", __func__);
-		return 0;
+		return U32_MAX;
 	}
 
 	return opp->level;

Applied. Thanks.

Signature · 1 line
viresh