From patchwork Wed Apr 11 01:04:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Gra=C5=BEvydas_Ignotas?= X-Patchwork-Id: 151722 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 000CCB704B for ; Wed, 11 Apr 2012 11:05:34 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SHlz9-00079f-BN; Wed, 11 Apr 2012 01:04:35 +0000 Received: from mail-we0-f177.google.com ([74.125.82.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SHlz7-000798-Ef for linux-mtd@lists.infradead.org; Wed, 11 Apr 2012 01:04:33 +0000 Received: by werp11 with SMTP id p11so291301wer.36 for ; Tue, 10 Apr 2012 18:04:31 -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:x-mailer; bh=+FmDp4/hsgolCPQsuhifJWKQ5CHjBmkxgyZ22zhBuA8=; b=uk18BmOvJ+sVZUefa52zEaQqYRfpwEDxf4BnxjKY+jx/gtbAMDFbWf1POFJuqNpnRe LAYcxCQY+7rlBkK9VEqwUYkoeOD4Rs52knOulfX0EcHLJDPeJENGelsdZTh/Ee0K5FbE 2MC1X/n9bGRmYc0ZwnD/rT6EwzMHXInEkYdhoorZuNcSci8Ln8l1VMtLCjJhBXbFE2en Mq+FVoJpTz1aLOgOJu8MeJPVRoUa97nmx/11Hr2k3iqtIP9gG6hwHHtPFz2Cdmmsd4Ub EEd0L7uJEE6hCz73Msw3ukt8AcR/F8yAlyBevfyiJLqRQmAHQXvHo1RLi8S2aPygaG2U Qx8w== Received: by 10.180.102.129 with SMTP id fo1mr11531470wib.6.1334106271090; Tue, 10 Apr 2012 18:04:31 -0700 (PDT) Received: from localhost.localdomain (ip-88-119-226-136.static.b4net.lt. [88.119.226.136]) by mx.google.com with ESMTPS id ex2sm3649494wib.8.2012.04.10.18.04.29 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 Apr 2012 18:04:30 -0700 (PDT) From: Grazvydas Ignotas To: linux-mtd@lists.infradead.org Subject: [PATCH] mtd: omap2: fix resource leak in prefetch-busy path Date: Wed, 11 Apr 2012 04:04:34 +0300 Message-Id: <1334106274-24993-1-git-send-email-notasas@gmail.com> X-Mailer: git-send-email 1.7.0.4 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (notasas[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.177 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Artem Bityutskiy , linux-omap@vger.kernel.org, David Woodhouse , Grazvydas Ignotas X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org If prefetch engine is busy, current code "forgets" to call dma_unmap_single(), which results in a deadlock later, so add it. Signed-off-by: Grazvydas Ignotas --- drivers/mtd/nand/omap2.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index f745f00..7feb274 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -402,7 +402,7 @@ static inline int omap_nand_dma_transfer(struct mtd_info *mtd, void *addr, PREFETCH_FIFOTHRESHOLD_MAX, 0x1, len, is_write); if (ret) /* PFPW engine is busy, use cpu copy method */ - goto out_copy; + goto out_copy_unmap; init_completion(&info->comp); @@ -421,6 +421,8 @@ static inline int omap_nand_dma_transfer(struct mtd_info *mtd, void *addr, dma_unmap_single(&info->pdev->dev, dma_addr, len, dir); return 0; +out_copy_unmap: + dma_unmap_single(&info->pdev->dev, dma_addr, len, dir); out_copy: if (info->nand.options & NAND_BUSWIDTH_16) is_write == 0 ? omap_read_buf16(mtd, (u_char *) addr, len)