From patchwork Thu May 23 15:25:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 17149 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f197.google.com (mail-gg0-f197.google.com [209.85.161.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 912BF2395B for ; Thu, 23 May 2013 15:26:49 +0000 (UTC) Received: by mail-gg0-f197.google.com with SMTP id u1sf3677193ggn.4 for ; Thu, 23 May 2013 08:25:54 -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=TkwcEBXjPaZa0I1/55uDjbfFdGxoQWj2TDyTRBKva5w=; b=SdLUT6Bef5Wimu0flhCy5iXMKuxP8oSLCR0ZrZAbYJQLOrbVOugi+MLYkNbkCDgvX+ 4AXuAVdje1XVIX6mtO5N4f0fsR62cCrjZ5XlUpzAR3979qCblXIT3qmBWotaAOGAGN40 oElvNxgNvb58eXfIklO1bLprqyobLCCwSUr81QL2T5pxFJ5EfPfCsTOLZNreyJ0Ty9QS SCx6whbD1M6+fYOh2NrpSGuKd9QVtZHsHk+veU8l/SRKDn0a59HJsOdehl4FJS5Z6lJH XWCqFOHOS5scG2jmrPk3N9vA7tCHELaHiTpuftSQwDeLShwEK7UEqn3n4iA1zLDg5Tmq 5jHQ== X-Received: by 10.236.119.106 with SMTP id m70mr6503775yhh.52.1369322754172; Thu, 23 May 2013 08:25:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.120.193 with SMTP id le1ls1348980qeb.66.gmail; Thu, 23 May 2013 08:25:53 -0700 (PDT) X-Received: by 10.59.9.39 with SMTP id dp7mr5641165ved.36.1369322753888; Thu, 23 May 2013 08:25:53 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id ha8si6650295vdb.22.2013.05.23.08.25.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:25:53 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id ht10so2297587vcb.18 for ; Thu, 23 May 2013 08:25:53 -0700 (PDT) X-Received: by 10.220.246.8 with SMTP id lw8mr5585120vcb.8.1369322753766; Thu, 23 May 2013 08:25:53 -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 c10csp57027vcs; Thu, 23 May 2013 08:25:53 -0700 (PDT) X-Received: by 10.180.183.139 with SMTP id em11mr44854009wic.16.1369322752605; Thu, 23 May 2013 08:25:52 -0700 (PDT) Received: from mail-we0-x22b.google.com (mail-we0-x22b.google.com [2a00:1450:400c:c03::22b]) by mx.google.com with ESMTPS id br11si9235607wib.46.2013.05.23.08.25.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:25:52 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22b is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::22b; Received: by mail-we0-f171.google.com with SMTP id t59so2227345wes.30 for ; Thu, 23 May 2013 08:25:52 -0700 (PDT) X-Received: by 10.180.188.141 with SMTP id ga13mr44955360wic.9.1369322752223; Thu, 23 May 2013 08:25:52 -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.50 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:25:51 -0700 (PDT) From: Lee Jones To: linux-kernel@vger.kernel.org, sameo@linux.intel.com Cc: Lee Jones Subject: [PATCH 14/16] mfd: janz-cmodio: Convert to managed resources for allocating memory Date: Thu, 23 May 2013 16:25:15 +0100 Message-Id: <1369322717-30429-14-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: ALoCoQks9h20wvKNsE9rPUY6uh+40kOgeBXnPRmptwPS53Z21JLRiMEe+QDPHI/fLCAOLivC+gkr X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 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/janz-cmodio.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/janz-cmodio.c b/drivers/mfd/janz-cmodio.c index 45ece11..fcbb2e9 100644 --- a/drivers/mfd/janz-cmodio.c +++ b/drivers/mfd/janz-cmodio.c @@ -183,11 +183,10 @@ static int cmodio_pci_probe(struct pci_dev *dev, struct cmodio_device *priv; int ret; - priv = kzalloc(sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) { dev_err(&dev->dev, "unable to allocate private data\n"); - ret = -ENOMEM; - goto out_return; + return -ENOMEM; } pci_set_drvdata(dev, priv); @@ -197,7 +196,7 @@ static int cmodio_pci_probe(struct pci_dev *dev, ret = pci_enable_device(dev); if (ret) { dev_err(&dev->dev, "unable to enable device\n"); - goto out_free_priv; + return ret; } pci_set_master(dev); @@ -248,9 +247,7 @@ out_pci_release_regions: pci_release_regions(dev); out_pci_disable_device: pci_disable_device(dev); -out_free_priv: - kfree(priv); -out_return: + return ret; } @@ -263,7 +260,6 @@ static void cmodio_pci_remove(struct pci_dev *dev) iounmap(priv->ctrl); pci_release_regions(dev); pci_disable_device(dev); - kfree(priv); } #define PCI_VENDOR_ID_JANZ 0x13c3