Commit ffe305d2 authored by Petr Cvek's avatar Petr Cvek Committed by Mauro Carvalho Chehab
Browse files

media: i2c: ov9640: fix missing error handling in probe



Control handlers registration lacked error path with
v4l2_ctrl_handler_free() call. Fix it by using goto to alread existing
v4l2_ctrl_handler_free() call.

Signed-off-by: default avatarPetr Cvek <petrcvekcz@gmail.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 95531e46
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -710,14 +710,18 @@ static int ov9640_probe(struct i2c_client *client,
			V4L2_CID_VFLIP, 0, 1, 1, 0);
	v4l2_ctrl_new_std(&priv->hdl, &ov9640_ctrl_ops,
			V4L2_CID_HFLIP, 0, 1, 1, 0);

	if (priv->hdl.error) {
		ret = priv->hdl.error;
		goto ectrlinit;
	}

	priv->subdev.ctrl_handler = &priv->hdl;
	if (priv->hdl.error)
		return priv->hdl.error;

	priv->clk = v4l2_clk_get(&client->dev, "mclk");
	if (IS_ERR(priv->clk)) {
		ret = PTR_ERR(priv->clk);
		goto eclkget;
		goto ectrlinit;
	}

	ret = ov9640_video_probe(client);
@@ -733,7 +737,7 @@ static int ov9640_probe(struct i2c_client *client,

eprobe:
	v4l2_clk_put(priv->clk);
eclkget:
ectrlinit:
	v4l2_ctrl_handler_free(&priv->hdl);

	return ret;