From patchwork Thu Oct 24 22:12:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 3093941 Return-Path: X-Original-To: patchwork-linux-omap@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 8C9BDBF924 for ; Thu, 24 Oct 2013 22:12:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CE53420498 for ; Thu, 24 Oct 2013 22:12:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 18465203C4 for ; Thu, 24 Oct 2013 22:12:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754668Ab3JXWMf (ORCPT ); Thu, 24 Oct 2013 18:12:35 -0400 Received: from top.free-electrons.com ([176.31.233.9]:52606 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754553Ab3JXWMe (ORCPT ); Thu, 24 Oct 2013 18:12:34 -0400 Received: by mail.free-electrons.com (Postfix, from userid 106) id 55BC37ED; Fri, 25 Oct 2013 00:12:38 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from localhost.localdomain (unknown [190.2.98.212]) by mail.free-electrons.com (Postfix) with ESMTPA id 1343F7E3; Fri, 25 Oct 2013 00:12:35 +0200 (CEST) From: Ezequiel Garcia To: , Cc: Brian Norris , Pekon Gupta , Felipe Balbi , Ezequiel Garcia Subject: [PATCH 4/5] mtd: nand: omap2: Use devm_kzalloc Date: Thu, 24 Oct 2013 19:12:16 -0300 Message-Id: <1382652737-20239-5-git-send-email-ezequiel.garcia@free-electrons.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1382652737-20239-1-git-send-email-ezequiel.garcia@free-electrons.com> References: <1382652737-20239-1-git-send-email-ezequiel.garcia@free-electrons.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This simplifies the error path and makes the code less error-prone. Signed-off-by: Ezequiel Garcia --- drivers/mtd/nand/omap2.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index e01a936..d4cafb0 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -1837,7 +1837,7 @@ static int omap_nand_probe(struct platform_device *pdev) return -ENODEV; } - info = kzalloc(sizeof(struct omap_nand_info), GFP_KERNEL); + info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); if (!info) return -ENOMEM; @@ -2066,9 +2066,6 @@ out_release_mem_region: if (info->gpmc_irq_fifo > 0) free_irq(info->gpmc_irq_fifo, info); release_mem_region(info->phys_base, info->mem_size); -out_free_info: - kfree(info); - return err; } @@ -2091,7 +2088,6 @@ static int omap_nand_remove(struct platform_device *pdev) nand_release(&info->mtd); iounmap(info->nand.IO_ADDR_R); release_mem_region(info->phys_base, info->mem_size); - kfree(info); return 0; }