From patchwork Sat Dec 3 21:28:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 129115 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-ww0-f56.google.com (mail-ww0-f56.google.com [74.125.82.56]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 1862CB6F9B for ; Sun, 4 Dec 2011 08:28:23 +1100 (EST) Received: by wgbdr12 with SMTP id dr12sf5944520wgb.11 for ; Sat, 03 Dec 2011 13:28:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=mime-version:x-beenthere:received-spf:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=1LCmcU8WAEQksqpNuLWJFxxZWdMSrCsZ0v/FVx4PwHI=; b=LRdwnDbGteWWsjD6IcYBTOzqa3ppsj94UpsbsfEFoaRcU8S2gRvzkUJpPHS1UWMTgT 4G8ipOxeJLu/3ZIXyd+qgbE5L8kJhaz2W0vsjaHTJlJnCZda/PORLA5hUtekUSD+zlaY 4RHnVO/SBE+Nlw3SO5tUOraDcpIpULll6r848= Received: by 10.216.136.154 with SMTP id w26mr69001wei.68.1322947699101; Sat, 03 Dec 2011 13:28:19 -0800 (PST) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.227.175.78 with SMTP id w14ls11964683wbz.4.gmail; Sat, 03 Dec 2011 13:28:18 -0800 (PST) Received: by 10.216.221.36 with SMTP id q36mr68366wep.0.1322947698618; Sat, 03 Dec 2011 13:28:18 -0800 (PST) Received: by 10.216.221.36 with SMTP id q36mr68365wep.0.1322947698601; Sat, 03 Dec 2011 13:28:18 -0800 (PST) Received: from opensource.wolfsonmicro.com (opensource.wolfsonmicro.com. [80.75.67.52]) by gmr-mx.google.com with ESMTPS id fj17si8913691wbb.1.2011.12.03.13.28.18 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 03 Dec 2011 13:28:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of broonie@opensource.wolfsonmicro.com designates 80.75.67.52 as permitted sender) client-ip=80.75.67.52; Received: from finisterre.wolfsonmicro.main (cpc2-sgyl4-0-0-cust247.sgyl.cable.virginmedia.com [82.41.24.248]) by opensource.wolfsonmicro.com (Postfix) with ESMTPSA id C19581108EB; Sat, 3 Dec 2011 21:28:17 +0000 (GMT) Received: from broonie by finisterre.wolfsonmicro.main with local (Exim 4.77) (envelope-from ) id 1RWx85-0006sJ-1G; Sat, 03 Dec 2011 21:28:17 +0000 From: Mark Brown To: Alessandro Zummo , Andrew Morton Cc: rtc-linux@googlegroups.com, patches@opensource.wolfsonmicro.com, Mark Brown Subject: [rtc-linux] [PATCH 2/2] rtc: Convert wm831x driver to devm_kzalloc() Date: Sat, 3 Dec 2011 21:28:09 +0000 Message-Id: <1322947689-26393-2-git-send-email-broonie@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1322947689-26393-1-git-send-email-broonie@opensource.wolfsonmicro.com> References: <1322947689-26393-1-git-send-email-broonie@opensource.wolfsonmicro.com> X-Original-Sender: broonie@opensource.wolfsonmicro.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of broonie@opensource.wolfsonmicro.com designates 80.75.67.52 as permitted sender) smtp.mail=broonie@opensource.wolfsonmicro.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , Marginally less code and eliminate the possibility of memory leaks. Signed-off-by: Mark Brown --- drivers/rtc/rtc-wm831x.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c index dabbd45..657c6f6 100644 --- a/drivers/rtc/rtc-wm831x.c +++ b/drivers/rtc/rtc-wm831x.c @@ -399,7 +399,7 @@ static int wm831x_rtc_probe(struct platform_device *pdev) int alm_irq = platform_get_irq_byname(pdev, "ALM"); int ret = 0; - wm831x_rtc = kzalloc(sizeof(*wm831x_rtc), GFP_KERNEL); + wm831x_rtc = devm_kzalloc(&pdev->dev, sizeof(*wm831x_rtc), GFP_KERNEL); if (wm831x_rtc == NULL) return -ENOMEM; @@ -434,7 +434,6 @@ static int wm831x_rtc_probe(struct platform_device *pdev) return 0; err: - kfree(wm831x_rtc); return ret; } @@ -445,7 +444,6 @@ static int __devexit wm831x_rtc_remove(struct platform_device *pdev) free_irq(alm_irq, wm831x_rtc); rtc_device_unregister(wm831x_rtc->rtc); - kfree(wm831x_rtc); return 0; }