From patchwork Wed Oct 10 13:20:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 1581221 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 06BDCDFABE for ; Thu, 11 Oct 2012 07:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755412Ab2JKHLr (ORCPT ); Thu, 11 Oct 2012 03:11:47 -0400 Received: from opensource.wolfsonmicro.com ([80.75.67.52]:56173 "EHLO opensource.wolfsonmicro.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755131Ab2JKHLq (ORCPT ); Thu, 11 Oct 2012 03:11:46 -0400 Received: from finisterre.wolfsonmicro.main (unknown [203.226.202.110]) by opensource.wolfsonmicro.com (Postfix) with ESMTPSA id 9594B110A97; Thu, 11 Oct 2012 08:11:45 +0100 (BST) Received: from broonie by finisterre.wolfsonmicro.main with local (Exim 4.80) (envelope-from ) id 1TLwDF-0001Ul-8F; Wed, 10 Oct 2012 22:20:37 +0900 From: Mark Brown To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, Mark Brown Subject: [PATCH 3/3] Input: wm831x-on - Convert to devm_kzalloc() Date: Wed, 10 Oct 2012 22:20:36 +0900 Message-Id: <1349875236-5707-3-git-send-email-broonie@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1349875236-5707-1-git-send-email-broonie@opensource.wolfsonmicro.com> References: <1349875236-5707-1-git-send-email-broonie@opensource.wolfsonmicro.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Saves a small amount of code and reduces the potential for leaks. Signed-off-by: Mark Brown --- drivers/input/misc/wm831x-on.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c index 6790a81..fa8b390 100644 --- a/drivers/input/misc/wm831x-on.c +++ b/drivers/input/misc/wm831x-on.c @@ -76,7 +76,8 @@ static int __devinit wm831x_on_probe(struct platform_device *pdev) int irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0)); int ret; - wm831x_on = kzalloc(sizeof(struct wm831x_on), GFP_KERNEL); + wm831x_on = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_on), + GFP_KERNEL); if (!wm831x_on) { dev_err(&pdev->dev, "Can't allocate data\n"); return -ENOMEM; @@ -120,7 +121,6 @@ err_irq: err_input_dev: input_free_device(wm831x_on->dev); err: - kfree(wm831x_on); return ret; } @@ -132,7 +132,6 @@ static int __devexit wm831x_on_remove(struct platform_device *pdev) free_irq(irq, wm831x_on); cancel_delayed_work_sync(&wm831x_on->work); input_unregister_device(wm831x_on->dev); - kfree(wm831x_on); return 0; }