diff options
author | Pan Bian <bianpan2016@163.com> | 2017-08-08 10:49:58 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-08-20 08:20:42 -0400 |
commit | 8ac9e914a49ffd5ce5877d332c190f24d13725a9 (patch) | |
tree | 16ee6e4ae662cb5c9e114f2e3bb79b8a7649a1a4 /drivers/media/platform/mtk-mdp | |
parent | 68d9c47b1679ec8d55a005d39fc7a958ece82095 (diff) | |
download | linux-next-8ac9e914a49ffd5ce5877d332c190f24d13725a9.tar.gz |
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>
Diffstat (limited to 'drivers/media/platform/mtk-mdp')
-rw-r--r-- | drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c index e728d32d9408..03aba03a24c8 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c @@ -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++) { - if (!comp->clk[i]) + if (IS_ERR(comp->clk[i])) continue; err = clk_prepare_enable(comp->clk[i]); if (err) @@ -90,7 +90,7 @@ void mtk_mdp_comp_clock_off(struct device *dev, struct mtk_mdp_comp *comp) int i; for (i = 0; i < ARRAY_SIZE(comp->clk); i++) { - if (!comp->clk[i]) + if (IS_ERR(comp->clk[i])) continue; clk_disable_unprepare(comp->clk[i]); } |