Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] vcodec: mediatek: Fix return value check in mtk_vcodec_init_enc_pm()

In case of error, the function devm_clk_get() returns ERR_PTR()
and not returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Wei Yongjun and committed by
Mauro Carvalho Chehab
2efeec2d 14ee452f

+8 -8
+8 -8
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
··· 67 67 pm->dev = &pdev->dev; 68 68 69 69 pm->vencpll_d2 = devm_clk_get(&pdev->dev, "venc_sel_src"); 70 - if (pm->vencpll_d2 == NULL) { 70 + if (IS_ERR(pm->vencpll_d2)) { 71 71 mtk_v4l2_err("devm_clk_get vencpll_d2 fail"); 72 - ret = -1; 72 + ret = PTR_ERR(pm->vencpll_d2); 73 73 } 74 74 75 75 pm->venc_sel = devm_clk_get(&pdev->dev, "venc_sel"); 76 - if (pm->venc_sel == NULL) { 76 + if (IS_ERR(pm->venc_sel)) { 77 77 mtk_v4l2_err("devm_clk_get venc_sel fail"); 78 - ret = -1; 78 + ret = PTR_ERR(pm->venc_sel); 79 79 } 80 80 81 81 pm->univpll1_d2 = devm_clk_get(&pdev->dev, "venc_lt_sel_src"); 82 - if (pm->univpll1_d2 == NULL) { 82 + if (IS_ERR(pm->univpll1_d2)) { 83 83 mtk_v4l2_err("devm_clk_get univpll1_d2 fail"); 84 - ret = -1; 84 + ret = PTR_ERR(pm->univpll1_d2); 85 85 } 86 86 87 87 pm->venc_lt_sel = devm_clk_get(&pdev->dev, "venc_lt_sel"); 88 - if (pm->venc_lt_sel == NULL) { 88 + if (IS_ERR(pm->venc_lt_sel)) { 89 89 mtk_v4l2_err("devm_clk_get venc_lt_sel fail"); 90 - ret = -1; 90 + ret = PTR_ERR(pm->venc_lt_sel); 91 91 } 92 92 93 93 return ret;