From patchwork Thu Jan 3 13:22:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 1927741 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by patchwork1.kernel.org (Postfix) with ESMTP id EA1B33FDDA for ; Thu, 3 Jan 2013 13:27:42 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r03DNvIB005981; Thu, 3 Jan 2013 07:23:57 -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 r03DNv1v020642; Thu, 3 Jan 2013 07:23:57 -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:23:57 -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 r03DNuv7005123; Thu, 3 Jan 2013 07:23:56 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id C1FE980627; Thu, 3 Jan 2013 07:23:56 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id 8CEF180626 for ; Thu, 3 Jan 2013 07:23:55 -0600 (CST) Received: from white.ext.ti.com (white.ext.ti.com [192.94.93.38]) by dflp51.itg.ti.com (8.13.7/8.13.8) with ESMTP id r03DNtwx026260 for ; Thu, 3 Jan 2013 07:23:55 -0600 (CST) Received: from psmtp.com (na3sys009amx189.postini.com [74.125.149.170]) by white.ext.ti.com (8.13.7/8.13.7) with SMTP id r03DNsRb029981 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 3 Jan 2013 07:23:54 -0600 Received: from mail-pa0-f47.google.com ([209.85.220.47]) (using TLSv1) by na3sys009amx189.postini.com ([74.125.148.10]) with SMTP; Thu, 03 Jan 2013 13:23:54 GMT Received: by mail-pa0-f47.google.com with SMTP id fa10so8610800pad.20 for ; Thu, 03 Jan 2013 05:23:53 -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=P7lBzrir3xSPgIqMCepUgpjgzRX8AlJ1Wo0m3kPtltc=; b=UBrpvg7xY4DMxvYLdLUhuvncWZ+GB6qxT2rX9kSj9LrlzSwOf46XeKEpDFjcbE2w8y qAwquuAdhw/S+IoYMofKhT468QKMtfas0Irslh+ImG0wbLiWNs3v4LT2Z/es9ccoc5Le yIGbT2UMVwD8LAgTxfsInECvcGE46pNUggI5WM3SbQKtR1N1xgDI2e3xoqAbVd/DeCRo aKvGHjwJAlUixx8cMTqZlpjS1XTecKfkZpASMVUTBT6XP96D3M+IO5dtYxGDRm+HJtol Y6A8/RQZsbtvD72U6OGu3/e/6sQbSbVO5OEp9aNjVgoc6+pGrNDLoyXRD8sVB04eh2Dl LZDA== X-Received: by 10.66.85.103 with SMTP id g7mr145652991paz.45.1357219433478; Thu, 03 Jan 2013 05:23:53 -0800 (PST) Received: from localhost.localdomain ([122.166.13.141]) by mx.google.com with ESMTPS id ix9sm30343226pbc.7.2013.01.03.05.23.49 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 Jan 2013 05:23:52 -0800 (PST) From: "Lad, Prabhakar" To: LMML Subject: [PATCH] ths7303: use devm_kzalloc() instead of kzalloc() Date: Thu, 3 Jan 2013 18:52:40 +0530 Message-ID: <1357219362-9080-2-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:19.01927/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/ths7303.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ths7303.c b/drivers/media/i2c/ths7303.c index c31cc04..e747524 100644 --- a/drivers/media/i2c/ths7303.c +++ b/drivers/media/i2c/ths7303.c @@ -175,7 +175,7 @@ static int ths7303_probe(struct i2c_client *client, v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); + sd = devm_kzalloc(&client->dev, sizeof(struct v4l2_subdev), GFP_KERNEL); if (sd == NULL) return -ENOMEM; @@ -189,7 +189,6 @@ static int ths7303_remove(struct i2c_client *client) struct v4l2_subdev *sd = i2c_get_clientdata(client); v4l2_device_unregister_subdev(sd); - kfree(sd); return 0; }