From patchwork Thu May 23 15:25:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 17136 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 EEA692395B for ; Thu, 23 May 2013 15:26:28 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id a12sf777071wgh.2 for ; Thu, 23 May 2013 08:25:33 -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 :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=xlORhH6qgAOcBGZVRVS8BpAxk941PGPWNBWqRIDaFlI=; b=ZvJ33BWf7P85CpuIxLs3d5OcWgea0Medl3aPtSfyxT/Z7jlDeAJUEjPeQWzFjAhh0m EWuEyQv5MB8kpJgvPMJpcsqIMZj+x8c8oINkeao7XRxjY10NrA9tcB7cLzfUPBFwXfTl KAi32Izg5AUHFk5jf90V/AY9+Ijql7V1AONNz7CoYeC8nFZLZBbVqK33znmwO/td8zb1 XpTMtG/G+pN6PumXJ3V9f0/iBsytIvDAJqdMI6TA1zmLPrrU+hv398+JCPFctlipJQQm vpw7pJZq/AIVrgKfgmMx+wGUT2IZgPIizDPQ68HlBhZXi/EAzXXsKik/c8hs9Wmj3PoT vK4A== X-Received: by 10.180.105.161 with SMTP id gn1mr6258780wib.6.1369322732654; Thu, 23 May 2013 08:25:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.87.42 with SMTP id u10ls1882915wiz.33.canary; Thu, 23 May 2013 08:25:32 -0700 (PDT) X-Received: by 10.180.36.147 with SMTP id q19mr25429880wij.26.1369322732458; Thu, 23 May 2013 08:25:32 -0700 (PDT) Received: from mail-ve0-x22d.google.com (mail-ve0-x22d.google.com [2607:f8b0:400c:c01::22d]) by mx.google.com with ESMTPS id s9si9232013wiv.52.2013.05.23.08.25.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:25:32 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22d 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::22d; Received: by mail-ve0-f173.google.com with SMTP id cy12so2513824veb.18 for ; Thu, 23 May 2013 08:25:31 -0700 (PDT) X-Received: by 10.220.246.8 with SMTP id lw8mr5583913vcb.8.1369322731354; Thu, 23 May 2013 08:25:31 -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 c10csp56994vcs; Thu, 23 May 2013 08:25:30 -0700 (PDT) X-Received: by 10.180.97.106 with SMTP id dz10mr37809059wib.2.1369322730132; Thu, 23 May 2013 08:25:30 -0700 (PDT) Received: from mail-wi0-x22d.google.com (mail-wi0-x22d.google.com [2a00:1450:400c:c05::22d]) by mx.google.com with ESMTPS id r7si14709544wiz.70.2013.05.23.08.25.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:25:30 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::22d is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c05::22d; Received: by mail-wi0-f173.google.com with SMTP id hi5so4645740wib.0 for ; Thu, 23 May 2013 08:25:29 -0700 (PDT) X-Received: by 10.181.13.112 with SMTP id ex16mr44852765wid.28.1369322729583; Thu, 23 May 2013 08:25:29 -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.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:25:28 -0700 (PDT) From: Lee Jones To: linux-kernel@vger.kernel.org, sameo@linux.intel.com Cc: Lee Jones Subject: [PATCH 01/16] mfd: tps65912: Convert to managed resources for allocating memory Date: Thu, 23 May 2013 16:25:02 +0100 Message-Id: <1369322717-30429-1-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQl/2l/c7T+S9/+MYmUVHgD9fPkjGjIsdx1wyJ15qyxv6iT7e/L9j6jJ2GDEROqom2DsTwVW X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22d 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: , Saves on code and simplifies the driver, as these resources are now tracked and freed automatically when the driver is realised. Signed-off-by: Lee Jones --- drivers/mfd/tps65912-core.c | 2 -- drivers/mfd/tps65912-i2c.c | 3 ++- drivers/mfd/tps65912-spi.c | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/tps65912-core.c b/drivers/mfd/tps65912-core.c index f91037a..7035743 100644 --- a/drivers/mfd/tps65912-core.c +++ b/drivers/mfd/tps65912-core.c @@ -161,7 +161,6 @@ int tps65912_device_init(struct tps65912 *tps65912) err: mfd_remove_devices(tps65912->dev); - kfree(tps65912); return ret; } @@ -169,7 +168,6 @@ void tps65912_device_exit(struct tps65912 *tps65912) { mfd_remove_devices(tps65912->dev); tps65912_irq_exit(tps65912); - kfree(tps65912); } MODULE_AUTHOR("Margarita Olaya "); diff --git a/drivers/mfd/tps65912-i2c.c b/drivers/mfd/tps65912-i2c.c index c041f2c..6a6343e 100644 --- a/drivers/mfd/tps65912-i2c.c +++ b/drivers/mfd/tps65912-i2c.c @@ -77,7 +77,8 @@ static int tps65912_i2c_probe(struct i2c_client *i2c, { struct tps65912 *tps65912; - tps65912 = kzalloc(sizeof(struct tps65912), GFP_KERNEL); + tps65912 = devm_kzalloc(&i2c->dev, + sizeof(struct tps65912), GFP_KERNEL); if (tps65912 == NULL) return -ENOMEM; diff --git a/drivers/mfd/tps65912-spi.c b/drivers/mfd/tps65912-spi.c index b45f460..69a5178 100644 --- a/drivers/mfd/tps65912-spi.c +++ b/drivers/mfd/tps65912-spi.c @@ -85,7 +85,8 @@ static int tps65912_spi_probe(struct spi_device *spi) { struct tps65912 *tps65912; - tps65912 = kzalloc(sizeof(struct tps65912), GFP_KERNEL); + tps65912 = devm_kzalloc(&spi->dev, + sizeof(struct tps65912), GFP_KERNEL); if (tps65912 == NULL) return -ENOMEM;