Re: [PATCH] opp: Fix required-opps phandle array count check

From: Viresh Kumar
Date: Mon Oct 04 2021 - 02:53:47 EST


On 30-09-21, 15:39, Pavankumar Kondeti wrote:
> 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@xxxxxxxxxxxxxx>
> ---
> drivers/opp/of.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/opp/of.c b/drivers/opp/of.c
> index 2a97c65..5437085 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),

Applied. Thanks.

--
viresh