From patchwork Tue Jan 9 20:39:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 46399 Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZ0hN-0006bA-3n; Tue, 09 Jan 2018 20:40:41 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757308AbeAIUkY (ORCPT + 1 other); Tue, 9 Jan 2018 15:40:24 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:44337 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756463AbeAIUjw (ORCPT ); Tue, 9 Jan 2018 15:39:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=lgAxKpinnPWyevGG9RQkpllFnNaxTxs0kb/g8/+waLw=; b=fm7RswOSYu+XnL9cThTJNMRkX 42JnQmlnE3PLg6FkYCEZOHm98vNRofUMTJRJ6iPE31YAjGjNRyVcXBazJQjIuAHdxkERF8hEw64jL WAM1Yg56fEZiFhHXQyo+SIG0/WnXwH0d9x5vGIWUEp+E/dB580nUnYySG36PLFZdvWjXFqpWTmHbT G7XiXMXv3KcrgFnmPAThiXCYghbSDHHHaKqlGUzY/pNYkFcyr5U85+sPchVvJhbdQ4o28rjMCxoAs ohU9wKL/ZL/HeUFxr9sA8xAnJYW1yIOdoHhA0fq8ABfXJtfqDEAHaS6kTwBVut9e+lKQEjAXdTaAb tgRjrKpog==; Received: from clnet-p099-196.ikbnet.co.at ([83.175.99.196] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1eZ0gZ-00034I-JD; Tue, 09 Jan 2018 20:39:52 +0000 From: Christoph Hellwig To: Bjorn Helgaas , Mauro Carvalho Chehab Cc: linux-pci@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] media/ttusb-dev: remove pci_zalloc_coherent abuse Date: Tue, 9 Jan 2018 21:39:38 +0100 Message-Id: <20180109203939.5930-3-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180109203939.5930-1-hch@lst.de> References: <20180109203939.5930-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Switch to a plain kzalloc instea of pci_zalloc_coherent to allocate memory for the USB DMA. Signed-off-by: Christoph Hellwig --- drivers/media/usb/ttusb-dec/ttusb_dec.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c b/drivers/media/usb/ttusb-dec/ttusb_dec.c index cdefb5dfbbdc..794ea8a78181 100644 --- a/drivers/media/usb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c @@ -127,7 +127,6 @@ struct ttusb_dec { struct urb *irq_urb; dma_addr_t irq_dma_handle; void *iso_buffer; - dma_addr_t iso_dma_handle; struct urb *iso_urb[ISO_BUF_COUNT]; int iso_stream_count; struct mutex iso_mutex; @@ -1185,11 +1184,7 @@ static void ttusb_dec_free_iso_urbs(struct ttusb_dec *dec) for (i = 0; i < ISO_BUF_COUNT; i++) usb_free_urb(dec->iso_urb[i]); - - pci_free_consistent(NULL, - ISO_FRAME_SIZE * (FRAMES_PER_ISO_BUF * - ISO_BUF_COUNT), - dec->iso_buffer, dec->iso_dma_handle); + kfree(dec->iso_buffer); } static int ttusb_dec_alloc_iso_urbs(struct ttusb_dec *dec) @@ -1198,10 +1193,8 @@ static int ttusb_dec_alloc_iso_urbs(struct ttusb_dec *dec) dprintk("%s\n", __func__); - dec->iso_buffer = pci_zalloc_consistent(NULL, - ISO_FRAME_SIZE * (FRAMES_PER_ISO_BUF * ISO_BUF_COUNT), - &dec->iso_dma_handle); - + dec->iso_buffer = kzalloc(ISO_FRAME_SIZE * + (FRAMES_PER_ISO_BUF * ISO_BUF_COUNT), GFP_KERNEL); if (!dec->iso_buffer) { dprintk("%s: pci_alloc_consistent - not enough memory\n", __func__);