Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp496403pxx; Wed, 28 Oct 2020 09:38:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyA5eDgbJJCX88FxvaPftinQhH3FrvfgOHmsuL0hKSsvYDlSko6x3lXSqmFn+uiMtSJ3vFZ X-Received: by 2002:a17:906:a1d4:: with SMTP id bx20mr8222945ejb.262.1603903086433; Wed, 28 Oct 2020 09:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603903086; cv=none; d=google.com; s=arc-20160816; b=o9eaKGSyDUMsx1WAw8AzAKiKvvu9hzV0FVswdrVMRO61Pienrrn/JWoPgTZiRYmSb3 YtlYqZ8IK85cVA5q4zozOSY101Yf9CKAmdXLbLp+1EsI0En2u2wAd9HOSdB9DUv8JjlL RWQI6HGv8DhK+jWTOYzyFtbElJZN8st/AXKlrIArZ8eTQrC1zIwOJHct8ZodofJhCNae Y9z8lVZRzNGtU3UPqgVRCYNNomEb+V5nICFCixM4DtMGFJYzaHXjLP3z0d+/Mf9uk7GB vW9JLGQM3cOyKvzwCg5lj0QGU2FDX9Y3mQfqTMf5o1X7O5bwHByduYRxkY9AbbCv1GJ4 IVeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wD13LPGvmXD6RnH5KJIlnfDOybY9+D3FCg2Fy5wRgNU=; b=AfAsnq8k1TZ7s0xFRQfVDHwYQs3ZGIz9ZEIQM4GnycOKIozf86jVet+VGdpYLDuDIj ACjmH4eB9fXBLT+bl7DMsZ7iXPtDGssQTQXFA4qPWsVGRzqGI86QcjaRoh9ZFm3TbdOt gRhN8woRmF5ngNtS6BjsoWs/Lcc71w1d9nsLmsNID3yh+9QgN9SPlqjuyVQD4x5A07hu G+GxMjOcl5OFKXfulG4Uo3DP/PCiUPcS4rBJamVg4lFXr65xngwHjGVdkDLFt6+1VkD/ vohC1apUMVNH7nib9Vepx7Y7g7zYjFvWhE4YFACeTDuPwHDIehTHJiH2wjTT0o1Gb8yh 1F7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VOm2szaU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u23si4033512ejj.163.2020.10.28.09.37.43; Wed, 28 Oct 2020 09:38:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VOm2szaU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1818157AbgJ0RRr (ORCPT + 99 others); Tue, 27 Oct 2020 13:17:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:58558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1782723AbgJ0O5c (ORCPT ); Tue, 27 Oct 2020 10:57:32 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4BF57204FD; Tue, 27 Oct 2020 14:57:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810651; bh=obqj9xDssofiCrEHrdg6hdZt9cOs/nPuUWR9BmhW1YQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VOm2szaU2vVj+L3DQGrqLNanlMGZXisoKm958ImLaMVyl6AQGs2djxNVGol0w172R yOfLFLA8IeH4KpRw6HPMQJ5ZyL1W1Lp9uWsznbQGGs+7IbgOHLjimub5coYNbCVAeE xR4nfWWSNTk0cyYOn2Ld/223aG5A8b83PB3e8MdU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Alex Dewar , Sasha Levin Subject: [PATCH 5.8 184/633] staging: emxx_udc: Fix passing of NULL to dma_alloc_coherent() Date: Tue, 27 Oct 2020 14:48:47 +0100 Message-Id: <20201027135531.319044658@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alex Dewar [ Upstream commit cc34073c6248e9cec801bf690d1455f264d12357 ] In nbu2ss_eq_queue() memory is allocated with dma_alloc_coherent(), though, strangely, NULL is passed as the struct device* argument. Pass the UDC's device instead. Fix up the corresponding call to dma_free_coherent() in the same way. Build-tested on x86 only. Fixes: 33aa8d45a4fe ("staging: emxx_udc: Add Emma Mobile USB Gadget driver") Reported-by: Dan Carpenter Signed-off-by: Alex Dewar Link: https://lore.kernel.org/r/20200825091928.55794-1-alex.dewar90@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/emxx_udc/emxx_udc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 03929b9d3a8bc..d0725bc8b48a4 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -2593,7 +2593,7 @@ static int nbu2ss_ep_queue(struct usb_ep *_ep, if (req->unaligned) { if (!ep->virt_buf) - ep->virt_buf = dma_alloc_coherent(NULL, PAGE_SIZE, + ep->virt_buf = dma_alloc_coherent(udc->dev, PAGE_SIZE, &ep->phys_buf, GFP_ATOMIC | GFP_DMA); if (ep->epnum > 0) { @@ -3148,7 +3148,7 @@ static int nbu2ss_drv_remove(struct platform_device *pdev) for (i = 0; i < NUM_ENDPOINTS; i++) { ep = &udc->ep[i]; if (ep->virt_buf) - dma_free_coherent(NULL, PAGE_SIZE, (void *)ep->virt_buf, + dma_free_coherent(udc->dev, PAGE_SIZE, (void *)ep->virt_buf, ep->phys_buf); } -- 2.25.1