diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2013-05-02 07:29:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-05-21 06:52:15 -0400 |
commit | c02b211df6fc54e51ee554c27a6736a11255a764 (patch) | |
tree | a2b78b3a7a0400550fdd89da110d1b21a9e1acb1 /drivers/media/i2c/tvaudio.c | |
parent | 95323361e5313733a54771c5059f5b352adbf32c (diff) |
[media] media: i2c: 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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/tvaudio.c')
-rw-r--r-- | drivers/media/i2c/tvaudio.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/media/i2c/tvaudio.c b/drivers/media/i2c/tvaudio.c index b72a59d3216a..fc69e9c27343 100644 --- a/drivers/media/i2c/tvaudio.c +++ b/drivers/media/i2c/tvaudio.c | |||
@@ -1910,7 +1910,7 @@ static int tvaudio_probe(struct i2c_client *client, const struct i2c_device_id * | |||
1910 | printk("\n"); | 1910 | printk("\n"); |
1911 | } | 1911 | } |
1912 | 1912 | ||
1913 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 1913 | chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); |
1914 | if (!chip) | 1914 | if (!chip) |
1915 | return -ENOMEM; | 1915 | return -ENOMEM; |
1916 | sd = &chip->sd; | 1916 | sd = &chip->sd; |
@@ -1930,7 +1930,6 @@ static int tvaudio_probe(struct i2c_client *client, const struct i2c_device_id * | |||
1930 | } | 1930 | } |
1931 | if (desc->name == NULL) { | 1931 | if (desc->name == NULL) { |
1932 | v4l2_dbg(1, debug, sd, "no matching chip description found\n"); | 1932 | v4l2_dbg(1, debug, sd, "no matching chip description found\n"); |
1933 | kfree(chip); | ||
1934 | return -EIO; | 1933 | return -EIO; |
1935 | } | 1934 | } |
1936 | v4l2_info(sd, "%s found @ 0x%x (%s)\n", desc->name, client->addr<<1, client->adapter->name); | 1935 | v4l2_info(sd, "%s found @ 0x%x (%s)\n", desc->name, client->addr<<1, client->adapter->name); |
@@ -2001,7 +2000,6 @@ static int tvaudio_probe(struct i2c_client *client, const struct i2c_device_id * | |||
2001 | int err = chip->hdl.error; | 2000 | int err = chip->hdl.error; |
2002 | 2001 | ||
2003 | v4l2_ctrl_handler_free(&chip->hdl); | 2002 | v4l2_ctrl_handler_free(&chip->hdl); |
2004 | kfree(chip); | ||
2005 | return err; | 2003 | return err; |
2006 | } | 2004 | } |
2007 | /* set controls to the default values */ | 2005 | /* set controls to the default values */ |
@@ -2043,7 +2041,6 @@ static int tvaudio_remove(struct i2c_client *client) | |||
2043 | 2041 | ||
2044 | v4l2_device_unregister_subdev(sd); | 2042 | v4l2_device_unregister_subdev(sd); |
2045 | v4l2_ctrl_handler_free(&chip->hdl); | 2043 | v4l2_ctrl_handler_free(&chip->hdl); |
2046 | kfree(chip); | ||
2047 | return 0; | 2044 | return 0; |
2048 | } | 2045 | } |
2049 | 2046 | ||