mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 23:20:05 +00:00
media: mtk-mdp: use IS_ERR to check return value of of_clk_get
Function of_clk_get() returns an ERR_PTR on failures. In file mtk_mdp_commp.c, its return value is checked against NULL. Such checks cannot prevent from accessing bad memory. This patch replaces the NULL checks with IS_ERR checks. Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
68d9c47b16
commit
8ac9e914a4
@ -75,7 +75,7 @@ void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
|
for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
|
||||||
if (!comp->clk[i])
|
if (IS_ERR(comp->clk[i]))
|
||||||
continue;
|
continue;
|
||||||
err = clk_prepare_enable(comp->clk[i]);
|
err = clk_prepare_enable(comp->clk[i]);
|
||||||
if (err)
|
if (err)
|
||||||
@ -90,7 +90,7 @@ void mtk_mdp_comp_clock_off(struct device *dev, struct mtk_mdp_comp *comp)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
|
for (i = 0; i < ARRAY_SIZE(comp->clk); i++) {
|
||||||
if (!comp->clk[i])
|
if (IS_ERR(comp->clk[i]))
|
||||||
continue;
|
continue;
|
||||||
clk_disable_unprepare(comp->clk[i]);
|
clk_disable_unprepare(comp->clk[i]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user