]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[media] s5k6aa: Use devm_kzalloc function
authorSachin Kamat <sachin.kamat@linaro.org>
Thu, 26 Jul 2012 05:23:32 +0000 (02:23 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 14 Aug 2012 01:10:57 +0000 (22:10 -0300)
devm_kzalloc() eliminates the need to free explicitly thereby
making the code a bit simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/s5k6aa.c

index decb648083460dc0ed21691e2bf76e3735c9b98d..045ca7f4f6cad9857dbd7fc6ee1596716ff1f5b3 100644 (file)
@@ -1568,7 +1568,7 @@ static int s5k6aa_probe(struct i2c_client *client,
                return -EINVAL;
        }
 
-       s5k6aa = kzalloc(sizeof(*s5k6aa), GFP_KERNEL);
+       s5k6aa = devm_kzalloc(&client->dev, sizeof(*s5k6aa), GFP_KERNEL);
        if (!s5k6aa)
                return -ENOMEM;
 
@@ -1592,7 +1592,7 @@ static int s5k6aa_probe(struct i2c_client *client,
        sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
        ret = media_entity_init(&sd->entity, 1, &s5k6aa->pad, 0);
        if (ret)
-               goto out_err1;
+               return ret;
 
        ret = s5k6aa_configure_gpios(s5k6aa, pdata);
        if (ret)
@@ -1627,8 +1627,6 @@ out_err3:
        s5k6aa_free_gpios(s5k6aa);
 out_err2:
        media_entity_cleanup(&s5k6aa->sd.entity);
-out_err1:
-       kfree(s5k6aa);
        return ret;
 }
 
@@ -1642,7 +1640,6 @@ static int s5k6aa_remove(struct i2c_client *client)
        media_entity_cleanup(&sd->entity);
        regulator_bulk_free(S5K6AA_NUM_SUPPLIES, s5k6aa->supplies);
        s5k6aa_free_gpios(s5k6aa);
-       kfree(s5k6aa);
 
        return 0;
 }