Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp218496pxx; Wed, 28 Oct 2020 03:09:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtsHMnyp1qFGZAMpVecm8cqAFbJPyKClewTjVx5m6//5QK3xjMgsZFGnP6DwiPygIDO2kW X-Received: by 2002:a17:906:9511:: with SMTP id u17mr6712283ejx.194.1603879783432; Wed, 28 Oct 2020 03:09:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603879783; cv=none; d=google.com; s=arc-20160816; b=0kDQmZ/FDABwGGVO3BAQkKeZX141aVHeSysUw0KqHN6TKRqzRJhLJ+MneRo9S2NlGA PB2ZzEy/XMnkFzOpX0ygrgTLR+TRTdDiUQi+CuUscFGcIi/ZRYRxZ9yWmEDyC0jBUunw rVeZkKYcXboomnxWG63rTIn4s9dVTHCRmqXzeJrFjls+CfXgXA3K148/FYyqs01hWJiT 9tYML8kRddQF/9AfCjoX2ndqJqnwDzG18OvOpgHNXzzYJSonqMtg+dDJbgvrHRREXq61 icYWT0ftIWvjF8a8dmZGNgZSerJ2RvUzlc3nrmFXocdvwh04BLn353wx3aYAntFWzVgF QxAw== 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=bP+WI4twk60V8yl6Wx++N8RcGtNhqOyygOwxUJS//o0=; b=agtvzHOtHHCjCrqBeIQU4QGDRA+WY0Maa+V9PdTpT8AyobdruWfbM6XBrlDVFbaaQh 0pGn8XjtpLgrdgRutqVN0QWqCyfLKe0uHDVdU+2xt1sQJ7blJPFspo9eHH8JKIW1eYR+ eQJNeRTeEZUSNceHXv3uO14ijFONHYsw5kCrS7Q6+HVdHIJYaoQ7v0GhGjYGjHiyoj3M +B2KejaJ5uvs4du/aFSsQGfOvl0Eku5ZFUYnpfATYIRC2oYn4w8rEjXsGai/6JBpff9x jAp1eiHFklqI2lAI7Rw/iDM9I+Kft9bjOG71AqahNQ1qiWO5PuR/pgDhGeebhIZ6L2qN /Pkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="zhQ2ler/"; 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 lg14si2653130ejb.82.2020.10.28.03.09.20; Wed, 28 Oct 2020 03:09:43 -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="zhQ2ler/"; 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 S1760534AbgJ0Oe4 (ORCPT + 99 others); Tue, 27 Oct 2020 10:34:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:60806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2902476AbgJ0Odv (ORCPT ); Tue, 27 Oct 2020 10:33:51 -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 3DD7E22202; Tue, 27 Oct 2020 14:33:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809231; bh=fCojRKFKbzKAGabAXLBdhs372pAVOGnVrVLOB7DtDWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zhQ2ler/UGChg3mNnskHIoaMSMgyCDCcd4RQ0HQmy+ES495Qvwj2ual57hvlBoYqc OtWTwdGPbHJOBqIMriIoIQ9s80WsrFjDKxhgyQz5oX2l//sBlGVp8c5lTD7OL+WcVP JAZMT2ir9kY5z7GDCflUZLm2qG1v6Y5wRMuv8jVo= 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.4 123/408] staging: emxx_udc: Fix passing of NULL to dma_alloc_coherent() Date: Tue, 27 Oct 2020 14:51:01 +0100 Message-Id: <20201027135500.818908013@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 147481bf680c3..a6c893ddbf280 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -2594,7 +2594,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) { @@ -3153,7 +3153,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