Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b279265c authored by Wei Yongjun's avatar Wei Yongjun Committed by Mauro Carvalho Chehab
Browse files

[media] davinci: vpfe: fix return value check in vpfe_enable_clock()



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

Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: default avatarLad, Prabhakar <prabhakar.csengg@gmail.com>
Reviewed-by: default avatarSakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 9719afae
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -243,7 +243,7 @@ static int vpfe_enable_clock(struct vpfe_device *vpfe_dev)


		vpfe_dev->clks[i] =
		vpfe_dev->clks[i] =
				clk_get(vpfe_dev->pdev, vpfe_cfg->clocks[i]);
				clk_get(vpfe_dev->pdev, vpfe_cfg->clocks[i]);
		if (vpfe_dev->clks[i] == NULL) {
		if (IS_ERR(vpfe_dev->clks[i])) {
			v4l2_err(vpfe_dev->pdev->driver,
			v4l2_err(vpfe_dev->pdev->driver,
				"Failed to get clock %s\n",
				"Failed to get clock %s\n",
				vpfe_cfg->clocks[i]);
				vpfe_cfg->clocks[i]);
@@ -264,7 +264,7 @@ static int vpfe_enable_clock(struct vpfe_device *vpfe_dev)
	return 0;
	return 0;
out:
out:
	for (i = 0; i < vpfe_cfg->num_clocks; i++)
	for (i = 0; i < vpfe_cfg->num_clocks; i++)
		if (vpfe_dev->clks[i]) {
		if (!IS_ERR(vpfe_dev->clks[i])) {
			clk_disable_unprepare(vpfe_dev->clks[i]);
			clk_disable_unprepare(vpfe_dev->clks[i]);
			clk_put(vpfe_dev->clks[i]);
			clk_put(vpfe_dev->clks[i]);
		}
		}