From patchwork Wed Jan 10 18:03:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 46423 Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZKk1-00026E-Ep; Wed, 10 Jan 2018 18:04:45 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752349AbeAJSDd (ORCPT + 1 other); Wed, 10 Jan 2018 13:03:33 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:34105 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751932AbeAJSD3 (ORCPT ); Wed, 10 Jan 2018 13:03:29 -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=IbkC1PmjW58Gzh0kZ8Yb847XKLYDL8XBqCf0aSVQlqk=; b=smm1MDUv9RP0Fy4Pao8YIl8Tx Xl98FpzH7gIU0zKlOLB2FruXp3sJg3o3ATaUuJEM+MYAKHGMWjUvKoyvFHogls6SssiRm/pV4XS70 AUPDkjitWTj3zGsSUMMAy0aiFhhb8DWaXjthyFkANqCDdpxegLNtmPfh2ECEWRCsDgXSuGDe08/p4 /71n2bLqCbgHOV03KT0YeG5eOl1W6ytYsSy36L6IPx7cIEuzIbJomZbPIqQjyOaNwQLQVqtHFAl/f VHlHJ5S3dQexo88rGWEe+DLP8xCUJT/SYyGYiZMK890nZBQRuDTs645yEdfGEKP+FhG9WrOfuI2iR /5PghoSlQ==; 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 1eZKil-0000bH-VY; Wed, 10 Jan 2018 18:03:28 +0000 From: Christoph Hellwig To: Bjorn Helgaas , Mauro Carvalho Chehab Cc: Kong Lai , linux-pci@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] media/ttusb-budget: remove pci_zalloc_coherent abuse Date: Wed, 10 Jan 2018 19:03:19 +0100 Message-Id: <20180110180322.30186-2-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180110180322.30186-1-hch@lst.de> References: <20180110180322.30186-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 instead of pci_zalloc_coherent to allocate memory for the USB DMA. Signed-off-by: Christoph Hellwig --- drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c index a142b9dc0feb..ea40a24947ba 100644 --- a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c @@ -102,7 +102,6 @@ struct ttusb { unsigned int isoc_in_pipe; void *iso_buffer; - dma_addr_t iso_dma_handle; struct urb *iso_urb[ISO_BUF_COUNT]; @@ -792,26 +791,17 @@ static void ttusb_free_iso_urbs(struct ttusb *ttusb) for (i = 0; i < ISO_BUF_COUNT; i++) usb_free_urb(ttusb->iso_urb[i]); - - pci_free_consistent(NULL, - ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF * - ISO_BUF_COUNT, ttusb->iso_buffer, - ttusb->iso_dma_handle); + kfree(ttusb->iso_buffer); } static int ttusb_alloc_iso_urbs(struct ttusb *ttusb) { int i; - ttusb->iso_buffer = pci_zalloc_consistent(NULL, - ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF * ISO_BUF_COUNT, - &ttusb->iso_dma_handle); - - if (!ttusb->iso_buffer) { - dprintk("%s: pci_alloc_consistent - not enough memory\n", - __func__); + ttusb->iso_buffer = kcalloc(FRAMES_PER_ISO_BUF * ISO_BUF_COUNT, + ISO_FRAME_SIZE, GFP_KERNEL); + if (!ttusb->iso_buffer) return -ENOMEM; - } for (i = 0; i < ISO_BUF_COUNT; i++) { struct urb *urb;