提交 6af6e9c8 编写于 作者: A Axel Lin 提交者: Mauro Carvalho Chehab

[media] saa6752hs: Convert to devm_kzalloc()

Using the managed function the kfree() calls can be removed from the
probe error path and the remove handler.
Signed-off-by: NAxel Lin <axel.lin@ingics.com>
Acked-by: NLad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
上级 43e9d4ab
...@@ -660,7 +660,7 @@ static const struct v4l2_subdev_ops saa6752hs_ops = { ...@@ -660,7 +660,7 @@ static const struct v4l2_subdev_ops saa6752hs_ops = {
static int saa6752hs_probe(struct i2c_client *client, static int saa6752hs_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct saa6752hs_state *h = kzalloc(sizeof(*h), GFP_KERNEL); struct saa6752hs_state *h;
struct v4l2_subdev *sd; struct v4l2_subdev *sd;
struct v4l2_ctrl_handler *hdl; struct v4l2_ctrl_handler *hdl;
u8 addr = 0x13; u8 addr = 0x13;
...@@ -668,6 +668,8 @@ static int saa6752hs_probe(struct i2c_client *client, ...@@ -668,6 +668,8 @@ static int saa6752hs_probe(struct i2c_client *client,
v4l_info(client, "chip found @ 0x%x (%s)\n", v4l_info(client, "chip found @ 0x%x (%s)\n",
client->addr << 1, client->adapter->name); client->addr << 1, client->adapter->name);
h = devm_kzalloc(&client->dev, sizeof(*h), GFP_KERNEL);
if (h == NULL) if (h == NULL)
return -ENOMEM; return -ENOMEM;
sd = &h->sd; sd = &h->sd;
...@@ -752,7 +754,6 @@ static int saa6752hs_probe(struct i2c_client *client, ...@@ -752,7 +754,6 @@ static int saa6752hs_probe(struct i2c_client *client,
int err = hdl->error; int err = hdl->error;
v4l2_ctrl_handler_free(hdl); v4l2_ctrl_handler_free(hdl);
kfree(h);
return err; return err;
} }
v4l2_ctrl_cluster(3, &h->video_bitrate_mode); v4l2_ctrl_cluster(3, &h->video_bitrate_mode);
...@@ -767,7 +768,6 @@ static int saa6752hs_remove(struct i2c_client *client) ...@@ -767,7 +768,6 @@ static int saa6752hs_remove(struct i2c_client *client)
v4l2_device_unregister_subdev(sd); v4l2_device_unregister_subdev(sd);
v4l2_ctrl_handler_free(&to_state(sd)->hdl); v4l2_ctrl_handler_free(&to_state(sd)->hdl);
kfree(to_state(sd));
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册