linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Thomas Dahlmann <dahlmann.thomas@arcor.de>,
	Felipe Balbi <balbi@ti.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, linux-geode@lists.infradead.org,
	linux-usb@vger.kernel.org,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Subject: [PATCH v2 04/12] usb: gadget: amd5536udc: use free_dma_pools
Date: Tue, 22 Sep 2015 18:54:29 +0530	[thread overview]
Message-ID: <1442928277-11022-5-git-send-email-sudipm.mukherjee@gmail.com> (raw)
In-Reply-To: <1442928277-11022-1-git-send-email-sudipm.mukherjee@gmail.com>

We have the function free_dma_pools() which frees all the dma pools. Use
it instead of calling all the functions separately. The if conditions
for data_requests and stp_requests are also not required here as this is
the remove function and we are here means probe has succeeded and dma
has been successfully allocated, so they cannot be NULL here.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/usb/gadget/udc/amd5536udc.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/usb/gadget/udc/amd5536udc.c b/drivers/usb/gadget/udc/amd5536udc.c
index 6223b1b..7805b29 100644
--- a/drivers/usb/gadget/udc/amd5536udc.c
+++ b/drivers/usb/gadget/udc/amd5536udc.c
@@ -3131,20 +3131,7 @@ static void udc_pci_remove(struct pci_dev *pdev)
 		return;
 
 	/* dma pool cleanup */
-	if (dev->data_requests)
-		pci_pool_destroy(dev->data_requests);
-
-	if (dev->stp_requests) {
-		/* cleanup DMA desc's for ep0in */
-		pci_pool_free(dev->stp_requests,
-			dev->ep[UDC_EP0OUT_IX].td_stp,
-			dev->ep[UDC_EP0OUT_IX].td_stp_dma);
-		pci_pool_free(dev->stp_requests,
-			dev->ep[UDC_EP0OUT_IX].td,
-			dev->ep[UDC_EP0OUT_IX].td_phys);
-
-		pci_pool_destroy(dev->stp_requests);
-	}
+	free_dma_pools(dev);
 
 	/* reset controller */
 	writel(AMD_BIT(UDC_DEVCFG_SOFTRESET), &dev->regs->cfg);
-- 
1.9.1


  parent reply	other threads:[~2015-09-22 13:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-22 13:24 [PATCH v2 00/12] usb: gadget: amd5536udc: fix memory leaks Sudip Mukherjee
2015-09-22 13:24 ` [PATCH v2 01/12] usb: gadget: amd5536udc: rewrite init_dma_pools Sudip Mukherjee
2015-09-22 13:24 ` [PATCH v2 02/12] usb: gadget: amd5536udc: fix error path Sudip Mukherjee
2015-09-22 14:37   ` Felipe Balbi
2015-09-22 14:42     ` Sudip Mukherjee
2015-09-22 14:59       ` Sudip Mukherjee
2015-09-22 15:19         ` Felipe Balbi
2015-09-22 16:32           ` Sudip Mukherjee
2015-09-30 13:51           ` Sudip Mukherjee
2015-09-22 13:24 ` [PATCH v2 03/12] usb: gadget: amd5536udc: use WARN_ON Sudip Mukherjee
2015-09-22 13:24 ` Sudip Mukherjee [this message]
2015-09-22 13:24 ` [PATCH v2 05/12] usb: gadget: amd5536udc: remove unnecessary conditions Sudip Mukherjee
2015-09-22 13:24 ` [PATCH v2 06/12] usb: gadget: amd5536udc: remove forward declaration of udc_probe Sudip Mukherjee
2015-09-22 13:24 ` [PATCH v2 07/12] usb: gadget: amd5536udc: remove forward declaration of udc_remote_wakeup Sudip Mukherjee
2015-09-22 13:24 ` [PATCH v2 08/12] usb: gadget: amd5536udc: remove forward declaration of udc_create_dma_chain Sudip Mukherjee
2015-09-22 13:24 ` [PATCH v2 09/12] usb: gadget: amd5536udc: remove forward declaration of udc_free_dma_chain Sudip Mukherjee
2015-09-22 13:24 ` [PATCH v2 10/12] usb: gadget: amd5536udc: remove forward declaration of udc_pci_* Sudip Mukherjee
2015-09-22 13:24 ` [PATCH v2 11/12] usb: gadget: amd5536udc: remove forward declaration of udc_basic_init Sudip Mukherjee
2015-09-22 13:24 ` [PATCH v2 12/12] usb: gadget: amd5536udc: NULL comparison Sudip Mukherjee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1442928277-11022-5-git-send-email-sudipm.mukherjee@gmail.com \
    --to=sudipm.mukherjee@gmail.com \
    --cc=balbi@ti.com \
    --cc=dahlmann.thomas@arcor.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-geode@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).