Skip to content

Commit

Permalink
opp: Fix return in _opp_add_static_v2()
Browse files Browse the repository at this point in the history
[ Upstream commit 27ff818 ]

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: deac870 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
YueHaibing authored and gregkh committed Nov 17, 2021
1 parent d192572 commit 0776aa4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/opp/of.c
Expand Up @@ -921,7 +921,7 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table,
free_opp:
_opp_free(new_opp);

return ERR_PTR(ret);
return ret ? ERR_PTR(ret) : NULL;
}

/* Initializes OPP tables based on new bindings */
Expand Down

0 comments on commit 0776aa4

Please sign in to comment.