From: Pavankumar Kondeti Date: Thu, 30 Sep 2021 10:09:08 +0000 (+0530) Subject: opp: Fix required-opps phandle array count check X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8b7912f4cb6c29a1223ca7f2472bf12c44cc285e;p=linux.git 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. Signed-off-by: Pavankumar Kondeti Signed-off-by: Viresh Kumar --- diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 2a97c6535c4c6..5437085fb3809 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -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),