From patchwork Sun Jun 29 16:21:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Heider X-Patchwork-Id: 4444711 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8118BBEEAA for ; Sun, 29 Jun 2014 16:25:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7A0620328 for ; Sun, 29 Jun 2014 16:25:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E17DE202F8 for ; Sun, 29 Jun 2014 16:25:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1HsD-0003XE-28; Sun, 29 Jun 2014 16:22:37 +0000 Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1Hru-0003O1-BB for linux-arm-kernel@lists.infradead.org; Sun, 29 Jun 2014 16:22:18 +0000 Received: by mail-wi0-f174.google.com with SMTP id bs8so4927806wib.1 for ; Sun, 29 Jun 2014 09:21:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2pD3vsC5hDmnrbTq1Msr3aYI2UfZ7ZOEEH1N0Q/r30Q=; b=eu/MlcuFk+UPsJaeywJ7Hu23+r2R8vlvoQOn73KScZxGgJMXiwQB1SYP8VxqbbpaGO 3OK+j4GaPNjMy/7q4eU7lS1Iwc0EjzK3MhFPSc6y/QQ6uZQp2b7mXw6z3evPmb/XBKMf /4Cyc10eHPpT/663A9G7hF7rAoTsi7GQuadHuysis40FmhhmfpIoP5MtARP3cO7YPhHy 0Mu5K8Ig2E+1Z499mYOTbqFnu+IulwLNcVPiljYaJON/4UOUzi17QoQQ5NXNSd/AmzNE VKj+wLrN5cJ/xANYte0djbOkNrlm2VdJVcF8Mmb6wxW0jON5a9Dmm+Go/SIr+bkcjXbq xxvA== X-Received: by 10.180.210.174 with SMTP id mv14mr24176002wic.47.1404058916233; Sun, 29 Jun 2014 09:21:56 -0700 (PDT) Received: from mamamia.internal (a89-182-10-130.net-htp.de. [89.182.10.130]) by mx.google.com with ESMTPSA id gh16sm21137573wic.3.2014.06.29.09.21.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 29 Jun 2014 09:21:55 -0700 (PDT) From: Andre Heider To: linux-omap@vger.kernel.org Subject: [PATCH 02/13] uio: uio_pruss: use devm_kzalloc() Date: Sun, 29 Jun 2014 18:21:36 +0200 Message-Id: <1404058907-21112-3-git-send-email-a.heider@gmail.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1404058907-21112-1-git-send-email-a.heider@gmail.com> References: <1404058907-21112-1-git-send-email-a.heider@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140629_092218_535677_6610F903 X-CRM114-Status: GOOD ( 13.51 ) X-Spam-Score: -0.1 (/) Cc: devicetree@vger.kernel.org, Paul Walmsley , Tony Lindgren , Greg Kroah-Hartman , Matt Porter , "Hans J . Koch" , =?UTF-8?q?Beno=C3=AEt=20Cousson?= , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replace kzalloc() by devm_kzalloc() and remove the kfree() calls. Signed-off-by: Andre Heider --- drivers/uio/uio_pruss.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c index c28d6e2..f07545b 100644 --- a/drivers/uio/uio_pruss.c +++ b/drivers/uio/uio_pruss.c @@ -109,9 +109,7 @@ static void pruss_cleanup(struct device *dev, struct uio_pruss_dev *gdev) gen_pool_free(gdev->sram_pool, gdev->sram_vaddr, sram_pool_sz); - kfree(gdev->info); clk_put(gdev->pruss_clk); - kfree(gdev); } static int pruss_probe(struct platform_device *pdev) @@ -123,24 +121,19 @@ static int pruss_probe(struct platform_device *pdev) int ret = -ENODEV, cnt = 0, len; struct uio_pruss_pdata *pdata = dev_get_platdata(dev); - gdev = kzalloc(sizeof(struct uio_pruss_dev), GFP_KERNEL); + gdev = devm_kzalloc(dev, sizeof(struct uio_pruss_dev), GFP_KERNEL); if (!gdev) return -ENOMEM; - gdev->info = kzalloc(sizeof(*p) * MAX_PRUSS_EVT, GFP_KERNEL); - if (!gdev->info) { - kfree(gdev); + gdev->info = devm_kzalloc(dev, sizeof(*p) * MAX_PRUSS_EVT, GFP_KERNEL); + if (!gdev->info) return -ENOMEM; - } /* Power on PRU in case its not done as part of boot-loader */ gdev->pruss_clk = clk_get(dev, "pruss"); if (IS_ERR(gdev->pruss_clk)) { dev_err(dev, "Failed to get clock\n"); - ret = PTR_ERR(gdev->pruss_clk); - kfree(gdev->info); - kfree(gdev); - return ret; + return PTR_ERR(gdev->pruss_clk); } else { clk_enable(gdev->pruss_clk); }