diff options
author | Sebastian Reichel <sre@kernel.org> | 2014-10-21 12:07:02 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-11-14 18:05:19 -0200 |
commit | 80cd5c7a4ed0561d52dbe71556f8b8ea5165d67b (patch) | |
tree | 768adbb2f11c9e168e669edb8a018b3fab9cd146 /drivers/media/radio/si4713 | |
parent | fbe14a124c1616af65ddfc1add2fd323aaec67ae (diff) |
[media] si4713: use managed memory allocation
Introduce the usage of managed memory allocation to
simplify the code slightly.
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/radio/si4713')
-rw-r--r-- | drivers/media/radio/si4713/si4713.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/media/radio/si4713/si4713.c b/drivers/media/radio/si4713/si4713.c index 952550e7be8..afea1c31124 100644 --- a/drivers/media/radio/si4713/si4713.c +++ b/drivers/media/radio/si4713/si4713.c @@ -1449,7 +1449,7 @@ static int si4713_probe(struct i2c_client *client, struct v4l2_ctrl_handler *hdl; int rval; - sdev = kzalloc(sizeof(*sdev), GFP_KERNEL); + sdev = devm_kzalloc(&client->dev, sizeof(*sdev), GFP_KERNEL); if (!sdev) { dev_err(&client->dev, "Failed to alloc video device.\n"); rval = -ENOMEM; @@ -1466,7 +1466,7 @@ static int si4713_probe(struct i2c_client *client, } else { rval = PTR_ERR(sdev->gpio_reset); dev_err(&client->dev, "Failed to request gpio: %d\n", rval); - goto free_sdev; + goto exit; } sdev->vdd = devm_regulator_get_optional(&client->dev, "vdd"); @@ -1614,8 +1614,6 @@ free_irq: free_irq(client->irq, sdev); free_ctrls: v4l2_ctrl_handler_free(hdl); -free_sdev: - kfree(sdev); exit: return rval; } @@ -1634,7 +1632,6 @@ static int si4713_remove(struct i2c_client *client) v4l2_device_unregister_subdev(sd); v4l2_ctrl_handler_free(sd->ctrl_handler); - kfree(sdev); return 0; } |