Skip to contentSkip to conversation

opp: Fix required-opps phandle array count check

PATCH Applied Pavankumar Kondeti 2 participants 2 messages Sep 30, 2021 – Oct 4, 2021 Operating performance points (OPP)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 opp: Fix required-opps phandle array count check

The 'required-opps' property is optional. So of_count_phandle_with_args() can return -ENOENT when queried for required-opps. Handle this case.

---
 drivers/opp/of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/opp/of.c +1 -1
index 2a97c65..5437085 100644
@@ -170,7 +170,7 @@ static void _opp_table_alloc_required_tables(struct opp_table *opp_table,
 	}
 
 	count = of_count_phandle_with_args(np, "required-opps", NULL);
-	if (!count)
+	if (count <= 0)
 		goto put_np;
 
 	required_opp_tables = kcalloc(count, sizeof(*required_opp_tables),
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
Applied
#1 lore raw
Quoted 13 lines · Pavankumar Kondeti

The 'required-opps' property is optional. So of_count_phandle_with_args() can return -ENOENT when queried for required-opps. Handle this case.

---
 drivers/opp/of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/opp/of.c +0 -0
index 2a97c65..5437085 100644

drivers/opp/of.c static void _opp_table_alloc_required_tables(struct opp_table *opp_table, · line 176

Quoted 8 lines
drivers/opp/of.c +1 -1
@@ -170,7 +170,7 @@ static void _opp_table_alloc_required_tables(struct opp_table *opp_table,
 	}
 
 	count = of_count_phandle_with_args(np, "required-opps", NULL);
-	if (!count)
+	if (count <= 0)
 		goto put_np;
 
 	required_opp_tables = kcalloc(count, sizeof(*required_opp_tables),

Applied. Thanks.

Signature · 1 line
viresh