From patchwork Tue Jun 12 17:33:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9235 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 4D98F23E0C for ; Tue, 12 Jun 2012 17:33:47 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 1D6AAA18322 for ; Tue, 12 Jun 2012 17:33:47 +0000 (UTC) Received: by ghbz12 with SMTP id z12so3988879ghb.11 for ; Tue, 12 Jun 2012 10:33:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=+0bmnv66MeAlJoWreSjfZlLJii3I8sjGFm1JFxPXBZg=; b=A6j9doj/7/WJnSxRF1swfZAYu4ome0sF2Zjw8J7AEgMBf/8pmIPKX7iW0w+GoFr2b5 F0W6Wgjh++FHx3Y9QWTlOFE7Yr/5L/Di8GvXk0SZLBwnwT+4b0DhmpfxGyEAxOBMsy45 4pkyfflU3PXkPsoedV4bzu1xhofUEJGcwU8fxQCT33ZwZCCfKfTs3y7teEHeJAnqLiV+ LxToKfOKhb2J1jtQrryQaFdRj1A+n5RFFM39Fa9J1Sf1kSHn+pKeqPf7iNBKtBLt5aWc sDeOKwZdGq+rclW9TBt3aDeZ3xUbYxDMhKmMTZpbO4y+SF81eT3ReOSUfD8t5xPYJPnT 954A== Received: by 10.50.163.99 with SMTP id yh3mr8949276igb.53.1339522426320; Tue, 12 Jun 2012 10:33:46 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp179649ibb; Tue, 12 Jun 2012 10:33:45 -0700 (PDT) Received: by 10.14.99.132 with SMTP id x4mr7449339eef.1.1339522425017; Tue, 12 Jun 2012 10:33:45 -0700 (PDT) Received: from eu1sys200aog116.obsmtp.com (eu1sys200aog116.obsmtp.com. [207.126.144.141]) by mx.google.com with SMTP id a49si9523986eeg.103.2012.06.12.10.33.42 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 12 Jun 2012 10:33:45 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.141 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.141; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.141 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob116.postini.com ([207.126.147.11]) with SMTP ID DSNKT9d9dbHBV+QXGQfZD5OeX9TBK7mp18xq@postini.com; Tue, 12 Jun 2012 17:33:44 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 850695F; Tue, 12 Jun 2012 17:33:18 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 804F44A; Tue, 12 Jun 2012 14:45:18 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 76274A8072; Tue, 12 Jun 2012 19:33:32 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 12 Jun 2012 19:33:39 +0200 From: Linus Walleij To: Ben Dooks , Wolfram Sang , Cc: Linus Walleij Subject: [PATCH 2/2] i2c: stu300: use devm allocation Date: Tue, 12 Jun 2012 19:33:37 +0200 Message-ID: <1339522417-606-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.9.2 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmCAZsUhmjF1qHBWcBbargeRIJjF9UyqLtTBC/prHEJ0lrNjLjuQ+RIUwt43D+T8ppcowTc From: Linus Walleij Allocate memory for device state using devm_kzalloc() to simplify accounting. Signed-off-by: Linus Walleij --- drivers/i2c/busses/i2c-stu300.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c index 79b7851..e5c10c5 100644 --- a/drivers/i2c/busses/i2c-stu300.c +++ b/drivers/i2c/busses/i2c-stu300.c @@ -873,7 +873,7 @@ stu300_probe(struct platform_device *pdev) int ret = 0; char clk_name[] = "I2C0"; - dev = kzalloc(sizeof(struct stu300_dev), GFP_KERNEL); + dev = devm_kzalloc(&pdev->dev, sizeof(struct stu300_dev), GFP_KERNEL); if (!dev) { dev_err(&pdev->dev, "could not allocate device struct\n"); ret = -ENOMEM; @@ -971,7 +971,6 @@ stu300_probe(struct platform_device *pdev) err_no_resource: clk_put(dev->clk); err_no_clk: - kfree(dev); err_no_devmem: dev_err(&pdev->dev, "failed to add " NAME " adapter: %d\n", pdev->id); @@ -1020,7 +1019,6 @@ stu300_remove(struct platform_device *pdev) clk_unprepare(dev->clk); clk_put(dev->clk); platform_set_drvdata(pdev, NULL); - kfree(dev); return 0; }