linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Dewar <alex.dewar90@gmail.com>
To: dan.carpenter@oracle.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alex Dewar <alex.dewar90@gmail.com>,
	"Javier F. Arias" <jarias.linux@gmail.com>,
	YueHaibing <yuehaibing@huawei.com>,
	"Frank A. Cancio Bello" <frank@generalsoftwareinc.com>,
	Saiyam Doshi <saiyamdoshi.in@gmail.com>,
	Magnus Damm <damm+renesas@opensource.se>,
	Simon Horman <horms+renesas@verge.net.au>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] staging: emxx_udc: Fix passing of NULL to dma_alloc_coherent()
Date: Mon, 24 Aug 2020 16:19:17 +0100	[thread overview]
Message-ID: <20200824151920.251446-1-alex.dewar90@gmail.com> (raw)
In-Reply-To: <20200824142118.GA223827@mwanda>

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.

Build-tested on x86 only.

Fixes: 33aa8d45a4fe ("staging: emxx_udc: Add Emma Mobile USB Gadget driver")
Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
---

So I *think* this is the right fix, but I don't have the hardware so
I've only been able to build-test it. My worry is that I could be
passing in the wrong struct device* here, which would squelch the
warning without fixing the breakage.

Can someone cleverer than me tell me if this makes sense?

- Alex
---
 drivers/staging/emxx_udc/emxx_udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index 03929b9d3a8b..09e91449c08c 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)  {
-- 
2.28.0


       reply	other threads:[~2020-08-24 15:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200824142118.GA223827@mwanda>
2020-08-24 15:19 ` Alex Dewar [this message]
2020-08-24 15:57   ` [PATCH] staging: emxx_udc: Fix passing of NULL to dma_alloc_coherent() Alex Dewar
2020-08-25  7:37     ` Dan Carpenter
2020-08-25  8:14       ` Alex Dewar
2020-08-25  8:28         ` Dan Carpenter
2020-08-25  9:19           ` [PATCH v2] " Alex Dewar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200824151920.251446-1-alex.dewar90@gmail.com \
    --to=alex.dewar90@gmail.com \
    --cc=damm+renesas@opensource.se \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=frank@generalsoftwareinc.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=horms+renesas@verge.net.au \
    --cc=jarias.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=saiyamdoshi.in@gmail.com \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).