aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-08-10 06:53:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-15 18:01:09 -0400
commit89e47e35685535c16a20dc7b9cf8f969024232bc (patch)
tree84f9437ae55455ea8710d8b54fdde884222e1eb3 /drivers/media
parentf5c99037428b95da2ccc16daae6764b519ae0a90 (diff)
[media] s5p-tv: Use devm_* functions in sii9234_drv.c file
devm_* functions are device managed functions and make error handling and cleanup cleaner and simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/s5p-tv/sii9234_drv.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/media/platform/s5p-tv/sii9234_drv.c b/drivers/media/platform/s5p-tv/sii9234_drv.c
index 6d348f90237..716d4846f8b 100644
--- a/drivers/media/platform/s5p-tv/sii9234_drv.c
+++ b/drivers/media/platform/s5p-tv/sii9234_drv.c
@@ -323,7 +323,7 @@ static int __devinit sii9234_probe(struct i2c_client *client,
323 struct sii9234_context *ctx; 323 struct sii9234_context *ctx;
324 int ret; 324 int ret;
325 325
326 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); 326 ctx = devm_kzalloc(&client->dev, sizeof(*ctx), GFP_KERNEL);
327 if (!ctx) { 327 if (!ctx) {
328 dev_err(dev, "out of memory\n"); 328 dev_err(dev, "out of memory\n");
329 ret = -ENOMEM; 329 ret = -ENOMEM;
@@ -331,18 +331,17 @@ static int __devinit sii9234_probe(struct i2c_client *client,
331 } 331 }
332 ctx->client = client; 332 ctx->client = client;
333 333
334 ctx->power = regulator_get(dev, "hdmi-en"); 334 ctx->power = devm_regulator_get(dev, "hdmi-en");
335 if (IS_ERR(ctx->power)) { 335 if (IS_ERR(ctx->power)) {
336 dev_err(dev, "failed to acquire regulator hdmi-en\n"); 336 dev_err(dev, "failed to acquire regulator hdmi-en\n");
337 ret = PTR_ERR(ctx->power); 337 return PTR_ERR(ctx->power);
338 goto fail_ctx;
339 } 338 }
340 339
341 ctx->gpio_n_reset = pdata->gpio_n_reset; 340 ctx->gpio_n_reset = pdata->gpio_n_reset;
342 ret = gpio_request(ctx->gpio_n_reset, "MHL_RST"); 341 ret = gpio_request(ctx->gpio_n_reset, "MHL_RST");
343 if (ret) { 342 if (ret) {
344 dev_err(dev, "failed to acquire MHL_RST gpio\n"); 343 dev_err(dev, "failed to acquire MHL_RST gpio\n");
345 goto fail_power; 344 return ret;
346 } 345 }
347 346
348 v4l2_i2c_subdev_init(&ctx->sd, client, &sii9234_ops); 347 v4l2_i2c_subdev_init(&ctx->sd, client, &sii9234_ops);
@@ -373,12 +372,6 @@ fail_pm:
373 pm_runtime_disable(dev); 372 pm_runtime_disable(dev);
374 gpio_free(ctx->gpio_n_reset); 373 gpio_free(ctx->gpio_n_reset);
375 374
376fail_power:
377 regulator_put(ctx->power);
378
379fail_ctx:
380 kfree(ctx);
381
382fail: 375fail:
383 dev_err(dev, "probe failed\n"); 376 dev_err(dev, "probe failed\n");
384 377
@@ -393,8 +386,6 @@ static int __devexit sii9234_remove(struct i2c_client *client)
393 386
394 pm_runtime_disable(dev); 387 pm_runtime_disable(dev);
395 gpio_free(ctx->gpio_n_reset); 388 gpio_free(ctx->gpio_n_reset);
396 regulator_put(ctx->power);
397 kfree(ctx);
398 389
399 dev_info(dev, "remove successful\n"); 390 dev_info(dev, "remove successful\n");
400 391