From patchwork Thu Jan 3 13:22:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 1927751 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by patchwork1.kernel.org (Postfix) with ESMTP id 9948E3FC33 for ; Thu, 3 Jan 2013 13:27:47 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r03DO1o0001464; Thu, 3 Jan 2013 07:24:01 -0600 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r03DO1ZA020752; Thu, 3 Jan 2013 07:24:01 -0600 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Thu, 3 Jan 2013 07:24:01 -0600 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id r03DO1XP005183; Thu, 3 Jan 2013 07:24:01 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 2C17C80627; Thu, 3 Jan 2013 07:24:01 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 476EB80626 for ; Thu, 3 Jan 2013 07:23:59 -0600 (CST) Received: from white.ext.ti.com (white.ext.ti.com [192.94.93.38]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id r03DNxEU003660 for ; Thu, 3 Jan 2013 07:23:59 -0600 (CST) Received: from psmtp.com (na3sys009amx215.postini.com [74.125.149.55]) by white.ext.ti.com (8.13.7/8.13.7) with SMTP id r03DNwRc030006 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 3 Jan 2013 07:23:58 -0600 Received: from mail-da0-f47.google.com ([209.85.210.47]) (using TLSv1) by na3sys009amx215.postini.com ([74.125.148.10]) with SMTP; Thu, 03 Jan 2013 07:23:58 CST Received: by mail-da0-f47.google.com with SMTP id s35so6964451dak.20 for ; Thu, 03 Jan 2013 05:23:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=PFKxzSpazlcbYtd5tzM2qVvLUDN/PzM7beELe5IVL3Y=; b=alRE8Ve7PUHfkulp9Tn18RPC0dVW+aILud0l2X7sRCvLoTGitMn4yP+9dB/PLohZuV H3nnpU2KlTQ2aQmNdHCeRdBrehkV9bvWnsT4JSApoLU7khOyAmdeHruACnAqywciflQl BuEqMzx4Q3jYIVG8Xmvh68rHgKZMp4zismfltJP/puKCXDWaARy/8bF3PrGxvGvOYvfV ZDOEw6GF4MwAcUx4c8Ge1ojdazyAaVdhOMJOFbh84UI7EdpvTQu9VQrapryW7ss2bmPI JVgUrHvgzkb5TZ4uV+W9lzBlculoGC5MyiV0u21JY9Twof9crVJky4D06FZjY98dTQeH +rcw== X-Received: by 10.66.76.198 with SMTP id m6mr145561901paw.32.1357219437809; Thu, 03 Jan 2013 05:23:57 -0800 (PST) Received: from localhost.localdomain ([122.166.13.141]) by mx.google.com with ESMTPS id ix9sm30343226pbc.7.2013.01.03.05.23.53 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 Jan 2013 05:23:56 -0800 (PST) From: "Lad, Prabhakar" To: LMML Subject: [PATCH] tvp514x: use devm_kzalloc() instead of kzalloc() Date: Thu, 3 Jan 2013 18:52:41 +0530 Message-ID: <1357219362-9080-3-git-send-email-prabhakar.lad@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1357219362-9080-1-git-send-email-prabhakar.lad@ti.com> References: <1357219362-9080-1-git-send-email-prabhakar.lad@ti.com> X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:10.67189/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-dkim: 1 skipped:no-policies X-pstn-settings: 2 (0.5000:0.0050) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [82/3] CC: DLOS , LKML , Hans Verkuil , Mauro Carvalho Chehab X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com I2C drivers can use devm_kzalloc() too in their .probe() methods. Doing so simplifies their clean up paths. Signed-off-by: Lad, Prabhakar Signed-off-by: Manjunath Hadli --- drivers/media/i2c/tvp514x.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c index d5e1021..53608ee 100644 --- a/drivers/media/i2c/tvp514x.c +++ b/drivers/media/i2c/tvp514x.c @@ -951,7 +951,7 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) return -ENODEV; } - decoder = kzalloc(sizeof(*decoder), GFP_KERNEL); + decoder = devm_kzalloc(&client->dev, sizeof(*decoder), GFP_KERNEL); if (!decoder) return -ENOMEM; @@ -995,11 +995,8 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) V4L2_CID_AUTOGAIN, 0, 1, 1, 1); sd->ctrl_handler = &decoder->hdl; if (decoder->hdl.error) { - int err = decoder->hdl.error; - v4l2_ctrl_handler_free(&decoder->hdl); - kfree(decoder); - return err; + return decoder->hdl.error; } v4l2_ctrl_handler_setup(&decoder->hdl); @@ -1023,7 +1020,6 @@ static int tvp514x_remove(struct i2c_client *client) v4l2_device_unregister_subdev(sd); v4l2_ctrl_handler_free(&decoder->hdl); - kfree(decoder); return 0; } /* TVP5146 Init/Power on Sequence */