From patchwork Thu May 23 15:25:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 17138 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 02F2523976 for ; Thu, 23 May 2013 15:26:31 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id a12sf776713wgh.6 for ; Thu, 23 May 2013 08:25:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=X+/5rYhr7nAzpnhetM97dKgZPBrbLr70mr1BRJcp8QY=; b=XPUoBQiw9re60tB1UNzJn0ya1RlpFSZGTuuwiZJzHUADb9Y9eolARl+0YKZRawPkxN f3GCN0kXlq9dRK3myYiZ+1VzARlYQX+XTh/4FzQv9kTAE1qDX3/GgMu62780gE7mrOp5 M8ek2+2cCiqtfQ2enLLjv1Fn2afVIDVgXg0Q3jiTbkWcOxORgc3jk9FcV4Vhf/A9dRQP hgwfeBq5nda0k8y1yvqQF6sbSPluGiFgjP3gXMkQ1rqg9+/yOLGhGw0wDe9RqPGiL802 tS9fHaAsuvMYm2MKfCXQmGU6nlyXb6XAtP3YQjrMazg+nb7HHAGowdSEqcLo+gex6BVk bR6Q== X-Received: by 10.180.76.76 with SMTP id i12mr3713668wiw.6.1369322735899; Thu, 23 May 2013 08:25:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.75.109 with SMTP id b13ls951031wiw.28.gmail; Thu, 23 May 2013 08:25:35 -0700 (PDT) X-Received: by 10.180.185.179 with SMTP id fd19mr25596600wic.1.1369322735805; Thu, 23 May 2013 08:25:35 -0700 (PDT) Received: from mail-ve0-x22a.google.com (mail-ve0-x22a.google.com [2607:f8b0:400c:c01::22a]) by mx.google.com with ESMTPS id o10si14708517wij.81.2013.05.23.08.25.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:25:35 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22a is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22a; Received: by mail-ve0-f170.google.com with SMTP id 15so2528338vea.15 for ; Thu, 23 May 2013 08:25:34 -0700 (PDT) X-Received: by 10.52.176.65 with SMTP id cg1mr4802284vdc.1.1369322734713; Thu, 23 May 2013 08:25:34 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.126.138 with SMTP id c10csp56997vcs; Thu, 23 May 2013 08:25:34 -0700 (PDT) X-Received: by 10.180.210.207 with SMTP id mw15mr25807734wic.10.1369322733496; Thu, 23 May 2013 08:25:33 -0700 (PDT) Received: from mail-wg0-x231.google.com (mail-wg0-x231.google.com [2a00:1450:400c:c00::231]) by mx.google.com with ESMTPS id b10si14708041wix.85.2013.05.23.08.25.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:25:33 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::231 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c00::231; Received: by mail-wg0-f49.google.com with SMTP id y10so2303921wgg.16 for ; Thu, 23 May 2013 08:25:33 -0700 (PDT) X-Received: by 10.180.37.243 with SMTP id b19mr25758104wik.12.1369322732941; Thu, 23 May 2013 08:25:32 -0700 (PDT) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPSA id d10sm36397561wik.0.2013.05.23.08.25.31 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:25:32 -0700 (PDT) From: Lee Jones To: linux-kernel@vger.kernel.org, sameo@linux.intel.com Cc: Lee Jones Subject: [PATCH 03/16] mfd: ab3100-otp: Convert to managed resources for allocating memory Date: Thu, 23 May 2013 16:25:04 +0100 Message-Id: <1369322717-30429-3-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1369322717-30429-1-git-send-email-lee.jones@linaro.org> References: <1369322717-30429-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQm8nXLIvXe3BMgEYXENfcVM/VpfsSM6IZ5wqkRe8dydgsv0RAvH04WpSuZD+PHyboSZmbim X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22a is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Signed-off-by: Lee Jones --- drivers/mfd/ab3100-otp.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/mfd/ab3100-otp.c b/drivers/mfd/ab3100-otp.c index d7ce016..c9af16c 100644 --- a/drivers/mfd/ab3100-otp.c +++ b/drivers/mfd/ab3100-otp.c @@ -187,7 +187,7 @@ static int __init ab3100_otp_probe(struct platform_device *pdev) int err = 0; int i; - otp = kzalloc(sizeof(struct ab3100_otp), GFP_KERNEL); + otp = devm_kzalloc(&pdev->dev, sizeof(struct ab3100_otp), GFP_KERNEL); if (!otp) { dev_err(&pdev->dev, "could not allocate AB3100 OTP device\n"); return -ENOMEM; @@ -199,7 +199,7 @@ static int __init ab3100_otp_probe(struct platform_device *pdev) err = ab3100_otp_read(otp); if (err) - goto err_otp_read; + return err; dev_info(&pdev->dev, "AB3100 OTP readout registered\n"); @@ -208,22 +208,19 @@ static int __init ab3100_otp_probe(struct platform_device *pdev) err = device_create_file(&pdev->dev, &ab3100_otp_attrs[i]); if (err) - goto err_create_file; + goto err; } /* debugfs entries */ err = ab3100_otp_init_debugfs(&pdev->dev, otp); if (err) - goto err_init_debugfs; + goto err; return 0; -err_init_debugfs: -err_create_file: +err: while (--i >= 0) device_remove_file(&pdev->dev, &ab3100_otp_attrs[i]); -err_otp_read: - kfree(otp); return err; } @@ -236,7 +233,6 @@ static int __exit ab3100_otp_remove(struct platform_device *pdev) device_remove_file(&pdev->dev, &ab3100_otp_attrs[i]); ab3100_otp_exit_debugfs(otp); - kfree(otp); return 0; }