From patchwork Thu Jul 26 06:23:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 10242 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 48A982402A for ; Thu, 26 Jul 2012 06:24:29 +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 127CCA1882F for ; Thu, 26 Jul 2012 06:24:28 +0000 (UTC) Received: by ghbz12 with SMTP id z12so1605618ghb.11 for ; Wed, 25 Jul 2012 23:24:28 -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:x-gm-message-state; bh=dzeqhG54inSmIOZx8e3F7WUNtVFhfSYZX2BWtYtBcuk=; b=CFEQPU3iKpgTXvZStxCzZvS5NERNot1r//Qrg3rohW28laCJ1w7mw0LONT1xqP1ew+ LszNdmSK3gRHY3/cQLZkNRFK6WekUEuPwYsItSK+FVXpT+SsrTkmCzeU6gk1BHoYtwss jhMw7AtzRZ7Qr7oBaXNrtn3Z6ttl0ww4ahGhhM2ZOmKp24a82RszeBSbjTpaovw5a0ez OmIuE1Cf3lA9KfXSmm5VZVwOFIx7lhAXgiTeGikr6iKqqUIH3rFeuhIBhpNz1M8rreIt MNGlw88QotryNWizuuBclo/gxwlj3W/zA+nYnJiaLGtdXqAoQiil0iTyv1KCPpXsFfaT fsJw== Received: by 10.50.182.229 with SMTP id eh5mr771642igc.38.1343283868204; Wed, 25 Jul 2012 23:24:28 -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.43.93.3 with SMTP id bs3csp125668icc; Wed, 25 Jul 2012 23:24:27 -0700 (PDT) Received: by 10.66.83.200 with SMTP id s8mr18193259pay.10.1343283867644; Wed, 25 Jul 2012 23:24:27 -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 os3si37968185pbb.293.2012.07.25.23.24.27 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Jul 2012 23:24:27 -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 pbbrr4 with SMTP id rr4so3094139pbb.37 for ; Wed, 25 Jul 2012 23:24:27 -0700 (PDT) Received: by 10.68.224.225 with SMTP id rf1mr2550265pbc.55.1343283867299; Wed, 25 Jul 2012 23:24:27 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id pq5sm15903760pbb.30.2012.07.25.23.24.24 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Jul 2012 23:24:26 -0700 (PDT) From: Sachin Kamat To: linux-media@vger.kernel.org Cc: mchehab@infradead.org, s.nawrocki@samsung.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 1/2] [media] s5k6aa: Use devm_kzalloc function Date: Thu, 26 Jul 2012 11:53:32 +0530 Message-Id: <1343283813-24326-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQnz01ws67Q15AvLXPeBfLVHwdxWSSYe0Vm2+Y4g+XBI25U9myQqfpEBldLQVA31NmaWrUsu devm_kzalloc() eliminates the need to free explicitly thereby making the code a bit simpler. Signed-off-by: Sachin Kamat Acked-by: Sylwester Nawrocki --- drivers/media/video/s5k6aa.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/media/video/s5k6aa.c b/drivers/media/video/s5k6aa.c index 6625e46..0c3bc58 100644 --- a/drivers/media/video/s5k6aa.c +++ b/drivers/media/video/s5k6aa.c @@ -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; }