From patchwork Thu Jan 21 20:28:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 368275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F934C433E9 for ; Thu, 21 Jan 2021 20:33:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6C9C23A58 for ; Thu, 21 Jan 2021 20:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726355AbhAUUdl (ORCPT ); Thu, 21 Jan 2021 15:33:41 -0500 Received: from mx2.suse.de ([195.135.220.15]:36520 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727102AbhAUUaA (ORCPT ); Thu, 21 Jan 2021 15:30:00 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C4D1FABDA; Thu, 21 Jan 2021 20:29:01 +0000 (UTC) From: Takashi Iwai To: Hans Verkuil Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: pwc: Fix the URB buffer allocation Date: Thu, 21 Jan 2021 21:28:55 +0100 Message-Id: <20210121202855.17400-1-tiwai@suse.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The URB buffer allocation of pwc driver involves with the dma_map_single(), and it needs to pass the right device. Currently it passes usb_device.dev, but it's no real device that manages the DMA. Since the passed device has no DMA mask set up, now the pwc driver hits the WARN_ON_ONCE() check in dma_map_page_attrs() (that was introduced in 5.10), resulting in an error at URB allocations. Eventually this ended up with the black output. This patch fixes the bug by passing the proper device, the bus controller, to make the URB allocation and map working again. BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1181133 Cc: Signed-off-by: Takashi Iwai Reviewed-by: Robert Foss --- drivers/media/usb/pwc/pwc-if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c index 61869636ec61..d771160bb168 100644 --- a/drivers/media/usb/pwc/pwc-if.c +++ b/drivers/media/usb/pwc/pwc-if.c @@ -461,7 +461,7 @@ static int pwc_isoc_init(struct pwc_device *pdev) urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint); urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; urb->transfer_buffer_length = ISO_BUFFER_SIZE; - urb->transfer_buffer = pwc_alloc_urb_buffer(&udev->dev, + urb->transfer_buffer = pwc_alloc_urb_buffer(udev->bus->controller, urb->transfer_buffer_length, &urb->transfer_dma); if (urb->transfer_buffer == NULL) { @@ -524,7 +524,7 @@ static void pwc_iso_free(struct pwc_device *pdev) if (urb) { PWC_DEBUG_MEMORY("Freeing URB\n"); if (urb->transfer_buffer) - pwc_free_urb_buffer(&urb->dev->dev, + pwc_free_urb_buffer(urb->dev->bus->controller, urb->transfer_buffer_length, urb->transfer_buffer, urb->transfer_dma);