Skip to contentSkip to conversation

opp: Fix return in _opp_add_static_v2()

PATCH Applied YueHaibing 2 participants 2 messages Oct 8, 2021 Operating performance points (OPP)

lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 opp: Fix return in _opp_add_static_v2()

Fix sparse warning:
drivers/opp/of.c:924 _opp_add_static_v2() warn: passing zero to 'ERR_PTR'

For duplicate OPPs 'ret' be set to zero.

Fixes deac8703da5f ("PM / OPP: _of_add_opp_table_v2(): increment count only if OPP is added")
---
 drivers/opp/of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/opp/of.c +1 -1
index 2a97c6535c4c..c32ae7497392 100644
@@ -921,7 +921,7 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table,
 free_opp:
 	_opp_free(new_opp);
 
-	return ERR_PTR(ret);
+	return ret ? ERR_PTR(ret) : NULL;
 }
 
 /* Initializes OPP tables based on new bindings */
Signature · 1 line
2.17.1
Applied
#1 lore raw
Quoted 16 lines · YueHaibing

Fix sparse warning:
drivers/opp/of.c:924 _opp_add_static_v2() warn: passing zero to 'ERR_PTR'

For duplicate OPPs 'ret' be set to zero.

Fixes deac8703da5f ("PM / OPP: _of_add_opp_table_v2(): increment count only if OPP is added")
---
 drivers/opp/of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/opp/of.c +0 -0
index 2a97c6535c4c..c32ae7497392 100644

drivers/opp/of.c static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, · line 927

Quoted 8 lines
drivers/opp/of.c +1 -1
@@ -921,7 +921,7 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table,
 free_opp:
 	_opp_free(new_opp);
 
-	return ERR_PTR(ret);
+	return ret ? ERR_PTR(ret) : NULL;
 }
 
 /* Initializes OPP tables based on new bindings */

Applied. Thanks.

Signature · 1 line
viresh