From patchwork Fri Aug 10 11:53:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 10678 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3E4A323E02 for ; Fri, 10 Aug 2012 11:55:27 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 077D4A1886D for ; Fri, 10 Aug 2012 11:55:26 +0000 (UTC) Received: by ghbg10 with SMTP id g10so1464223ghb.11 for ; Fri, 10 Aug 2012 04:55:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=tmUZR+uRfLg90FEdKNTlMcU2uQIud0KE4yQ97ffQrMc=; b=RwyqdhraXePrD/yzCQe3mj/6PqSur4aTTgPCcuPE8BkRNwbDJ4c0DPBBxbi6uKyrUT hbPx4ZVgqkprFhNtKSBAxvHWAlAzRzrBtqNsnW93oONIoyph01zgxqZdxvp1UFbcfoVP Ij9nQ9UP3lMTWjM/7/j1bmk7fkNz0fs7MsPlsb6W3b7w3j6L6HdxTP6unH3Ppa8Q4n/Q TIQQje3HbEIGN/fmLb8zp0lZGyJaBdZYMAV/z3GYmYZ5PISeNbaDI/aFR8pRD+AyjqxP ro65VWkmX5pb6IE9R596z0NOGGYAAoDR90NyN+ScnSmJuTabiOQFiOVj7POjbunswho/ 8QXA== Received: by 10.50.186.131 with SMTP id fk3mr1460704igc.31.1344599726003; Fri, 10 Aug 2012 04:55:26 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.200 with SMTP id ew8csp56437igc; Fri, 10 Aug 2012 04:55:25 -0700 (PDT) Received: by 10.50.56.170 with SMTP id b10mr1467175igq.19.1344599725697; Fri, 10 Aug 2012 04:55:25 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id rc7si6088957igb.14.2012.08.10.04.55.25 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 10 Aug 2012 04:55:25 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by pbcmd12 with SMTP id md12so2943249pbc.37 for ; Fri, 10 Aug 2012 04:55:25 -0700 (PDT) Received: by 10.68.221.70 with SMTP id qc6mr12232219pbc.92.1344599724991; Fri, 10 Aug 2012 04:55:24 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id tq4sm3228260pbc.11.2012.08.10.04.55.21 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 10 Aug 2012 04:55:24 -0700 (PDT) From: Sachin Kamat To: linux-media@vger.kernel.org Cc: t.stanislaws@samsung.com, mchehab@infradead.org, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 2/2] [media] s5p-tv: Use devm_* functions in sii9234_drv.c file Date: Fri, 10 Aug 2012 17:23:46 +0530 Message-Id: <1344599626-21881-2-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1344599626-21881-1-git-send-email-sachin.kamat@linaro.org> References: <1344599626-21881-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQkBE7sx56CsncKsRW001n0DrZ5NqtoD7nB6m/9muxfV3W581AP/MnoR7JYT48EJ79YJ/wEh devm_* functions are device managed functions and make error handling and cleanup cleaner and simpler. Signed-off-by: Sachin Kamat --- drivers/media/video/s5p-tv/sii9234_drv.c | 17 ++++------------- 1 files changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/media/video/s5p-tv/sii9234_drv.c b/drivers/media/video/s5p-tv/sii9234_drv.c index 6d348f9..716d484 100644 --- a/drivers/media/video/s5p-tv/sii9234_drv.c +++ b/drivers/media/video/s5p-tv/sii9234_drv.c @@ -323,7 +323,7 @@ static int __devinit sii9234_probe(struct i2c_client *client, struct sii9234_context *ctx; int ret; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc(&client->dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) { dev_err(dev, "out of memory\n"); ret = -ENOMEM; @@ -331,18 +331,17 @@ static int __devinit sii9234_probe(struct i2c_client *client, } ctx->client = client; - ctx->power = regulator_get(dev, "hdmi-en"); + ctx->power = devm_regulator_get(dev, "hdmi-en"); if (IS_ERR(ctx->power)) { dev_err(dev, "failed to acquire regulator hdmi-en\n"); - ret = PTR_ERR(ctx->power); - goto fail_ctx; + return PTR_ERR(ctx->power); } ctx->gpio_n_reset = pdata->gpio_n_reset; ret = gpio_request(ctx->gpio_n_reset, "MHL_RST"); if (ret) { dev_err(dev, "failed to acquire MHL_RST gpio\n"); - goto fail_power; + return ret; } v4l2_i2c_subdev_init(&ctx->sd, client, &sii9234_ops); @@ -373,12 +372,6 @@ fail_pm: pm_runtime_disable(dev); gpio_free(ctx->gpio_n_reset); -fail_power: - regulator_put(ctx->power); - -fail_ctx: - kfree(ctx); - fail: dev_err(dev, "probe failed\n"); @@ -393,8 +386,6 @@ static int __devexit sii9234_remove(struct i2c_client *client) pm_runtime_disable(dev); gpio_free(ctx->gpio_n_reset); - regulator_put(ctx->power); - kfree(ctx); dev_info(dev, "remove successful\n");