From patchwork Thu May 23 15:25:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 17139 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f70.google.com (mail-qe0-f70.google.com [209.85.128.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 11F3225E1D for ; Thu, 23 May 2013 15:26:32 +0000 (UTC) Received: by mail-qe0-f70.google.com with SMTP id 2sf3166838qea.5 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=5iEpgOrO1rRAnflPdrUI0W07YYTliTrRtO0JJW3zLWw=; b=fbIkZMWvs28PKVvHF/tf0K0cc8/50aIMiPNYXcvpI1FGQipR9S8w9ux7qbgQGR9APa ynIuUxd3RrF7B8XXuJj/k88nJlimXj/1lY8dj7+ZFVCG9G9kFj9UqtnbSkdMFyeQMvwz fcI1RBkSdXJ4zd5847uB5bdhi8TBx+K54xoC8UwqbKdDNXJk06yCZUApPa7tQrRkrl1J 7iKNBbYCIcdX3aTdDelhK4K/hiRRYkJfgpe+4GZ0Nav+AUesBH5shXa5794vxGhwL1NO V/ccsec/Hq+ncSc1vfvhhibsqRpYcwvW0QM66551sC1DiFJHyjeisKZAwYJ+wj6J+/QK 7hbQ== X-Received: by 10.236.131.194 with SMTP id m42mr6438210yhi.30.1369322736559; Thu, 23 May 2013 08:25:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.83.36 with SMTP id n4ls1339558qey.76.gmail; Thu, 23 May 2013 08:25:36 -0700 (PDT) X-Received: by 10.52.249.41 with SMTP id yr9mr4911755vdc.17.1369322736312; Thu, 23 May 2013 08:25:36 -0700 (PDT) Received: from mail-ve0-x231.google.com (mail-ve0-x231.google.com [2607:f8b0:400c:c01::231]) by mx.google.com with ESMTPS id ad7si6623917vdc.107.2013.05.23.08.25.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:25:36 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::231 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::231; Received: by mail-ve0-f177.google.com with SMTP id ox1so2493095veb.22 for ; Thu, 23 May 2013 08:25:36 -0700 (PDT) X-Received: by 10.52.69.200 with SMTP id g8mr4765695vdu.4.1369322736186; Thu, 23 May 2013 08:25:36 -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 c10csp56998vcs; Thu, 23 May 2013 08:25:35 -0700 (PDT) X-Received: by 10.180.86.38 with SMTP id m6mr44506082wiz.25.1369322735098; Thu, 23 May 2013 08:25:35 -0700 (PDT) Received: from mail-we0-x22f.google.com (mail-we0-x22f.google.com [2a00:1450:400c:c03::22f]) by mx.google.com with ESMTPS id ga13si14706386wic.99.2013.05.23.08.25.34 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: 2a00:1450:400c:c03::22f is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::22f; Received: by mail-we0-f175.google.com with SMTP id p60so2198922wes.6 for ; Thu, 23 May 2013 08:25:34 -0700 (PDT) X-Received: by 10.181.13.74 with SMTP id ew10mr26031030wid.9.1369322734708; Thu, 23 May 2013 08:25:34 -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.33 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:25:33 -0700 (PDT) From: Lee Jones To: linux-kernel@vger.kernel.org, sameo@linux.intel.com Cc: Lee Jones Subject: [PATCH 04/16] mfd: ab8500-debug: Convert to managed resources for allocating memory Date: Thu, 23 May 2013 16:25:05 +0100 Message-Id: <1369322717-30429-4-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: ALoCoQlr0h2Hs3F3MOsj2in7Xdy95W0rHMcAnP7iZU6RQIXK9F9fbT1DItoLSE+j32javTJSQSG1 X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::231 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/ab8500-debugfs.c | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index 37b7ce4..7e80a0e 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c @@ -2937,7 +2937,6 @@ static struct dentry *ab8500_gpadc_dir; static int ab8500_debug_probe(struct platform_device *plf) { struct dentry *file; - int ret = -ENOMEM; struct ab8500 *ab8500; struct resource *res; debug_bank = AB8500_MISC; @@ -2946,24 +2945,26 @@ static int ab8500_debug_probe(struct platform_device *plf) ab8500 = dev_get_drvdata(plf->dev.parent); num_irqs = ab8500->mask_size; - irq_count = kzalloc(sizeof(*irq_count)*num_irqs, GFP_KERNEL); + irq_count = devm_kzalloc(&plf->dev, + sizeof(*irq_count)*num_irqs, GFP_KERNEL); if (!irq_count) return -ENOMEM; - dev_attr = kzalloc(sizeof(*dev_attr)*num_irqs,GFP_KERNEL); + dev_attr = devm_kzalloc(&plf->dev, + sizeof(*dev_attr)*num_irqs,GFP_KERNEL); if (!dev_attr) - goto out_freeirq_count; + return -ENOMEM; - event_name = kzalloc(sizeof(*event_name)*num_irqs, GFP_KERNEL); + event_name = devm_kzalloc(&plf->dev, + sizeof(*event_name)*num_irqs, GFP_KERNEL); if (!event_name) - goto out_freedev_attr; + return -ENOMEM; res = platform_get_resource_byname(plf, 0, "IRQ_AB8500"); if (!res) { dev_err(&plf->dev, "AB8500 irq not found, err %d\n", irq_first); - ret = -ENXIO; - goto out_freeevent_name; + return ENXIO; } irq_ab8500 = res->start; @@ -2971,16 +2972,14 @@ static int ab8500_debug_probe(struct platform_device *plf) if (irq_first < 0) { dev_err(&plf->dev, "First irq not found, err %d\n", irq_first); - ret = irq_first; - goto out_freeevent_name; + return irq_first; } irq_last = platform_get_irq_byname(plf, "IRQ_LAST"); if (irq_last < 0) { dev_err(&plf->dev, "Last irq not found, err %d\n", irq_last); - ret = irq_last; - goto out_freeevent_name; + return irq_last; } ab8500_dir = debugfs_create_dir(AB8500_NAME_STRING, NULL); @@ -3189,22 +3188,13 @@ err: if (ab8500_dir) debugfs_remove_recursive(ab8500_dir); dev_err(&plf->dev, "failed to create debugfs entries.\n"); -out_freeevent_name: - kfree(event_name); -out_freedev_attr: - kfree(dev_attr); -out_freeirq_count: - kfree(irq_count); - return ret; + return -ENOMEM; } static int ab8500_debug_remove(struct platform_device *plf) { debugfs_remove_recursive(ab8500_dir); - kfree(event_name); - kfree(dev_attr); - kfree(irq_count); return 0; }