opp: Fix required-opps phandle array count check
authorPavankumar Kondeti <pkondeti@codeaurora.org>
Thu, 30 Sep 2021 10:09:08 +0000 (15:39 +0530)
committerViresh Kumar <viresh.kumar@linaro.org>
Mon, 4 Oct 2021 06:53:09 +0000 (12:23 +0530)
The 'required-opps' property is optional. So of_count_phandle_with_args()
can return -ENOENT when queried for required-opps. Handle this case.

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/opp/of.c

index 2a97c6535c4c6e29ea47b1b2494f53d9c2342c36..5437085fb3809a495dd8190df244a0fa4ff6909c 100644 (file)
@@ -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),