opp: Fix return in _opp_add_static_v2()
authorYueHaibing <yuehaibing@huawei.com>
Fri, 8 Oct 2021 07:46:52 +0000 (15:46 +0800)
committerViresh Kumar <viresh.kumar@linaro.org>
Fri, 8 Oct 2021 07:54:46 +0000 (13:24 +0530)
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")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/opp/of.c

index fe218af735b0ebfeab7f7de1e6682bf588f860a5..2f40afa4e65c5a0c315a75bf44c94730c10af656 100644 (file)
@@ -921,7 +921,7 @@ free_required_opps:
 free_opp:
        _opp_free(new_opp);
 
-       return ERR_PTR(ret);
+       return ret ? ERR_PTR(ret) : NULL;
 }
 
 /* Initializes OPP tables based on new bindings */