* [PATCH 1/6] usb: musb: return -ESHUTDOWN in urb when three-strikes error happened
2020-05-25 2:50 [PATCH 0/6] musb patches for v5.8-rc1 Bin Liu
@ 2020-05-25 2:50 ` Bin Liu
2020-05-25 2:50 ` [PATCH 2/6] usb: musb: start session in resume for host port Bin Liu
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Bin Liu @ 2020-05-25 2:50 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu
When a USB device attached to a hub got disconnected, MUSB controller
generates RXCSR_RX_ERROR interrupt for the 3-strikes-out error.
Currently the MUSB host driver returns -EPROTO in current URB, then the
USB device driver could immediately resubmit the URB which causes MUSB
generate RXCSR_RX_ERROR interrupt again. This circle causes interrupt
storm then the hub never got a chance to report the USB device detach.
To fix the interrupt storm, change the URB return code to -ESHUTDOWN for
MUSB_RXCSR_H_ERROR interrupt, so that the USB device driver will not
immediately resubmit the URB.
Signed-off-by: Bin Liu <b-liu@ti.com>
---
drivers/usb/musb/musb_host.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 8736f4251a22..8b7d22a0c0fb 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -1774,9 +1774,15 @@ void musb_host_rx(struct musb *musb, u8 epnum)
status = -EPIPE;
} else if (rx_csr & MUSB_RXCSR_H_ERROR) {
- musb_dbg(musb, "end %d RX proto error", epnum);
+ dev_err(musb->controller, "ep%d RX three-strikes error", epnum);
- status = -EPROTO;
+ /*
+ * The three-strikes error could only happen when the USB
+ * device is not accessible, for example detached or powered
+ * off. So return the fatal error -ESHUTDOWN so hopefully the
+ * USB device drivers won't immediately resubmit the same URB.
+ */
+ status = -ESHUTDOWN;
musb_writeb(epio, MUSB_RXINTERVAL, 0);
rx_csr &= ~MUSB_RXCSR_H_ERROR;
--
2.17.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/6] usb: musb: start session in resume for host port
2020-05-25 2:50 [PATCH 0/6] musb patches for v5.8-rc1 Bin Liu
2020-05-25 2:50 ` [PATCH 1/6] usb: musb: return -ESHUTDOWN in urb when three-strikes error happened Bin Liu
@ 2020-05-25 2:50 ` Bin Liu
2020-05-25 2:50 ` [PATCH 3/6] usb: musb: use true for 'use_dma' Bin Liu
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Bin Liu @ 2020-05-25 2:50 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu
Commit 17539f2f4f0b ("usb: musb: fix enumeration after resume") replaced
musb_start() in musb_resume() to not override softconnect bit, but it
doesn't restart the session for host port which was done in musb_start().
The session could be disabled in musb_suspend(), which leads the host
port doesn't stay in host mode.
So let's start the session specifically for host port in musb_resume().
Fixes: 17539f2f4f0b ("usb: musb: fix enumeration after resume")
Cc: stable@vger.kernel.org
Signed-off-by: Bin Liu <b-liu@ti.com>
---
drivers/usb/musb/musb_core.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index d590110539ab..48178aeccf5b 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2877,6 +2877,13 @@ static int musb_resume(struct device *dev)
musb_enable_interrupts(musb);
musb_platform_enable(musb);
+ /* session might be disabled in suspend */
+ if (musb->port_mode == MUSB_HOST &&
+ !(musb->ops->quirks & MUSB_PRESERVE_SESSION)) {
+ devctl |= MUSB_DEVCTL_SESSION;
+ musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
+ }
+
spin_lock_irqsave(&musb->lock, flags);
error = musb_run_resume_work(musb);
if (error)
--
2.17.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/6] usb: musb: use true for 'use_dma'
2020-05-25 2:50 [PATCH 0/6] musb patches for v5.8-rc1 Bin Liu
2020-05-25 2:50 ` [PATCH 1/6] usb: musb: return -ESHUTDOWN in urb when three-strikes error happened Bin Liu
2020-05-25 2:50 ` [PATCH 2/6] usb: musb: start session in resume for host port Bin Liu
@ 2020-05-25 2:50 ` Bin Liu
2020-05-25 2:50 ` [PATCH 4/6] usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle Bin Liu
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Bin Liu @ 2020-05-25 2:50 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu
From: Jason Yan <yanaijie@huawei.com>
Fix the following coccicheck warning:
drivers/usb/musb/musb_core.c:1798:12-19: WARNING: Assignment of 0/1 to
bool variable
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
drivers/usb/musb/musb_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 48178aeccf5b..384a8039a7fd 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1795,7 +1795,7 @@ irqreturn_t musb_interrupt(struct musb *musb)
EXPORT_SYMBOL_GPL(musb_interrupt);
#ifndef CONFIG_MUSB_PIO_ONLY
-static bool use_dma = 1;
+static bool use_dma = true;
/* "modprobe ... use_dma=0" etc */
module_param(use_dma, bool, 0644);
--
2.17.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/6] usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle
2020-05-25 2:50 [PATCH 0/6] musb patches for v5.8-rc1 Bin Liu
` (2 preceding siblings ...)
2020-05-25 2:50 ` [PATCH 3/6] usb: musb: use true for 'use_dma' Bin Liu
@ 2020-05-25 2:50 ` Bin Liu
2020-06-17 8:17 ` Macpaul Lin
2020-05-25 2:50 ` [PATCH 5/6] usb: musb: jz4740: Prevent lockup when CONFIG_SMP is set Bin Liu
2020-05-25 2:50 ` [PATCH 6/6] usb: musb: Fix runtime PM imbalance on error Bin Liu
5 siblings, 1 reply; 11+ messages in thread
From: Bin Liu @ 2020-05-25 2:50 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu
From: Macpaul Lin <macpaul.lin@mediatek.com>
When receiving reset interrupt, FADDR need to be reset to zero in
peripheral mode. Otherwise ep0 cannot do enumeration when re-plugging USB
cable.
Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
Acked-by: Min Guo <min.guo@mediatek.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
drivers/usb/musb/mediatek.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/usb/musb/mediatek.c b/drivers/usb/musb/mediatek.c
index 6196b0e8d77d..eebeadd26946 100644
--- a/drivers/usb/musb/mediatek.c
+++ b/drivers/usb/musb/mediatek.c
@@ -208,6 +208,12 @@ static irqreturn_t generic_interrupt(int irq, void *__hci)
musb->int_rx = musb_clearw(musb->mregs, MUSB_INTRRX);
musb->int_tx = musb_clearw(musb->mregs, MUSB_INTRTX);
+ if ((musb->int_usb & MUSB_INTR_RESET) && !is_host_active(musb)) {
+ /* ep0 FADDR must be 0 when (re)entering peripheral mode */
+ musb_ep_select(musb->mregs, 0);
+ musb_writeb(musb->mregs, MUSB_FADDR, 0);
+ }
+
if (musb->int_usb || musb->int_tx || musb->int_rx)
retval = musb_interrupt(musb);
--
2.17.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 4/6] usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle
2020-05-25 2:50 ` [PATCH 4/6] usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle Bin Liu
@ 2020-06-17 8:17 ` Macpaul Lin
2020-06-17 8:58 ` Greg Kroah-Hartman
0 siblings, 1 reply; 11+ messages in thread
From: Macpaul Lin @ 2020-06-17 8:17 UTC (permalink / raw)
To: Bin Liu; +Cc: Greg Kroah-Hartman, linux-usb, stable
Bin Liu <b-liu@ti.com> 於 2020年5月25日 週一 上午10:53寫道:
>
> From: Macpaul Lin <macpaul.lin@mediatek.com>
>
> When receiving reset interrupt, FADDR need to be reset to zero in
> peripheral mode. Otherwise ep0 cannot do enumeration when re-plugging USB
> cable.
>
> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
> Acked-by: Min Guo <min.guo@mediatek.com>
> Signed-off-by: Bin Liu <b-liu@ti.com>
> ---
> drivers/usb/musb/mediatek.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/usb/musb/mediatek.c b/drivers/usb/musb/mediatek.c
> index 6196b0e8d77d..eebeadd26946 100644
> --- a/drivers/usb/musb/mediatek.c
> +++ b/drivers/usb/musb/mediatek.c
> @@ -208,6 +208,12 @@ static irqreturn_t generic_interrupt(int irq, void *__hci)
> musb->int_rx = musb_clearw(musb->mregs, MUSB_INTRRX);
> musb->int_tx = musb_clearw(musb->mregs, MUSB_INTRTX);
>
> + if ((musb->int_usb & MUSB_INTR_RESET) && !is_host_active(musb)) {
> + /* ep0 FADDR must be 0 when (re)entering peripheral mode */
> + musb_ep_select(musb->mregs, 0);
> + musb_writeb(musb->mregs, MUSB_FADDR, 0);
> + }
> +
> if (musb->int_usb || musb->int_tx || musb->int_rx)
> retval = musb_interrupt(musb);
>
> --
> 2.17.1
>
Could this bug fix also been applied to stable kernel?
Thanks!
Best regards,
Macpaul Lin
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/6] usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle
2020-06-17 8:17 ` Macpaul Lin
@ 2020-06-17 8:58 ` Greg Kroah-Hartman
2020-06-17 9:31 ` Macpaul Lin
0 siblings, 1 reply; 11+ messages in thread
From: Greg Kroah-Hartman @ 2020-06-17 8:58 UTC (permalink / raw)
To: Macpaul Lin; +Cc: Bin Liu, linux-usb, stable
On Wed, Jun 17, 2020 at 04:17:07PM +0800, Macpaul Lin wrote:
> Bin Liu <b-liu@ti.com> 於 2020年5月25日 週一 上午10:53寫道:
> >
> > From: Macpaul Lin <macpaul.lin@mediatek.com>
> >
> > When receiving reset interrupt, FADDR need to be reset to zero in
> > peripheral mode. Otherwise ep0 cannot do enumeration when re-plugging USB
> > cable.
> >
> > Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
> > Acked-by: Min Guo <min.guo@mediatek.com>
> > Signed-off-by: Bin Liu <b-liu@ti.com>
> > ---
> > drivers/usb/musb/mediatek.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/usb/musb/mediatek.c b/drivers/usb/musb/mediatek.c
> > index 6196b0e8d77d..eebeadd26946 100644
> > --- a/drivers/usb/musb/mediatek.c
> > +++ b/drivers/usb/musb/mediatek.c
> > @@ -208,6 +208,12 @@ static irqreturn_t generic_interrupt(int irq, void *__hci)
> > musb->int_rx = musb_clearw(musb->mregs, MUSB_INTRRX);
> > musb->int_tx = musb_clearw(musb->mregs, MUSB_INTRTX);
> >
> > + if ((musb->int_usb & MUSB_INTR_RESET) && !is_host_active(musb)) {
> > + /* ep0 FADDR must be 0 when (re)entering peripheral mode */
> > + musb_ep_select(musb->mregs, 0);
> > + musb_writeb(musb->mregs, MUSB_FADDR, 0);
> > + }
> > +
> > if (musb->int_usb || musb->int_tx || musb->int_rx)
> > retval = musb_interrupt(musb);
> >
> > --
> > 2.17.1
> >
> Could this bug fix also been applied to stable kernel?
Sure, what is the git commit of it in Linus's tree?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/6] usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle
2020-06-17 8:58 ` Greg Kroah-Hartman
@ 2020-06-17 9:31 ` Macpaul Lin
2020-06-19 8:51 ` Greg Kroah-Hartman
0 siblings, 1 reply; 11+ messages in thread
From: Macpaul Lin @ 2020-06-17 9:31 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Macpaul Lin, Bin Liu, linux-usb, stable
On Wed, 2020-06-17 at 10:58 +0200, Greg Kroah-Hartman wrote:
> On Wed, Jun 17, 2020 at 04:17:07PM +0800, Macpaul Lin wrote:
> > Bin Liu <b-liu@ti.com> 於 2020年5月25日 週一 上午10:53寫道:
> > >
> > > From: Macpaul Lin <macpaul.lin@mediatek.com>
> > >
> > > When receiving reset interrupt, FADDR need to be reset to zero in
> > > peripheral mode. Otherwise ep0 cannot do enumeration when re-plugging USB
> > > cable.
> > >
> > > Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
> > > Acked-by: Min Guo <min.guo@mediatek.com>
> > > Signed-off-by: Bin Liu <b-liu@ti.com>
> > > ---
> > > drivers/usb/musb/mediatek.c | 6 ++++++
> > > 1 file changed, 6 insertions(+)
> > >
> > > diff --git a/drivers/usb/musb/mediatek.c b/drivers/usb/musb/mediatek.c
> > > index 6196b0e8d77d..eebeadd26946 100644
> > > --- a/drivers/usb/musb/mediatek.c
> > > +++ b/drivers/usb/musb/mediatek.c
> > > @@ -208,6 +208,12 @@ static irqreturn_t generic_interrupt(int irq, void *__hci)
> > > musb->int_rx = musb_clearw(musb->mregs, MUSB_INTRRX);
> > > musb->int_tx = musb_clearw(musb->mregs, MUSB_INTRTX);
> > >
> > > + if ((musb->int_usb & MUSB_INTR_RESET) && !is_host_active(musb)) {
> > > + /* ep0 FADDR must be 0 when (re)entering peripheral mode */
> > > + musb_ep_select(musb->mregs, 0);
> > > + musb_writeb(musb->mregs, MUSB_FADDR, 0);
> > > + }
> > > +
> > > if (musb->int_usb || musb->int_tx || musb->int_rx)
> > > retval = musb_interrupt(musb);
> > >
> > > --
> > > 2.17.1
> > >
> > Could this bug fix also been applied to stable kernel?
>
> Sure, what is the git commit of it in Linus's tree?
>
> thanks,
>
> greg k-h
The commit id of this patch should be
402bcac4b25b520c89ba60db85eb6316f36e797f
Thank you very much.
BR
Macpaul Lin
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/6] usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle
2020-06-17 9:31 ` Macpaul Lin
@ 2020-06-19 8:51 ` Greg Kroah-Hartman
0 siblings, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2020-06-19 8:51 UTC (permalink / raw)
To: Macpaul Lin; +Cc: Macpaul Lin, Bin Liu, linux-usb, stable
On Wed, Jun 17, 2020 at 05:31:57PM +0800, Macpaul Lin wrote:
> On Wed, 2020-06-17 at 10:58 +0200, Greg Kroah-Hartman wrote:
> > On Wed, Jun 17, 2020 at 04:17:07PM +0800, Macpaul Lin wrote:
> > > Bin Liu <b-liu@ti.com> 於 2020年5月25日 週一 上午10:53寫道:
> > > >
> > > > From: Macpaul Lin <macpaul.lin@mediatek.com>
> > > >
> > > > When receiving reset interrupt, FADDR need to be reset to zero in
> > > > peripheral mode. Otherwise ep0 cannot do enumeration when re-plugging USB
> > > > cable.
> > > >
> > > > Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
> > > > Acked-by: Min Guo <min.guo@mediatek.com>
> > > > Signed-off-by: Bin Liu <b-liu@ti.com>
> > > > ---
> > > > drivers/usb/musb/mediatek.c | 6 ++++++
> > > > 1 file changed, 6 insertions(+)
> > > >
> > > > diff --git a/drivers/usb/musb/mediatek.c b/drivers/usb/musb/mediatek.c
> > > > index 6196b0e8d77d..eebeadd26946 100644
> > > > --- a/drivers/usb/musb/mediatek.c
> > > > +++ b/drivers/usb/musb/mediatek.c
> > > > @@ -208,6 +208,12 @@ static irqreturn_t generic_interrupt(int irq, void *__hci)
> > > > musb->int_rx = musb_clearw(musb->mregs, MUSB_INTRRX);
> > > > musb->int_tx = musb_clearw(musb->mregs, MUSB_INTRTX);
> > > >
> > > > + if ((musb->int_usb & MUSB_INTR_RESET) && !is_host_active(musb)) {
> > > > + /* ep0 FADDR must be 0 when (re)entering peripheral mode */
> > > > + musb_ep_select(musb->mregs, 0);
> > > > + musb_writeb(musb->mregs, MUSB_FADDR, 0);
> > > > + }
> > > > +
> > > > if (musb->int_usb || musb->int_tx || musb->int_rx)
> > > > retval = musb_interrupt(musb);
> > > >
> > > > --
> > > > 2.17.1
> > > >
> > > Could this bug fix also been applied to stable kernel?
> >
> > Sure, what is the git commit of it in Linus's tree?
> >
> > thanks,
> >
> > greg k-h
>
> The commit id of this patch should be
> 402bcac4b25b520c89ba60db85eb6316f36e797f
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 5/6] usb: musb: jz4740: Prevent lockup when CONFIG_SMP is set
2020-05-25 2:50 [PATCH 0/6] musb patches for v5.8-rc1 Bin Liu
` (3 preceding siblings ...)
2020-05-25 2:50 ` [PATCH 4/6] usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle Bin Liu
@ 2020-05-25 2:50 ` Bin Liu
2020-05-25 2:50 ` [PATCH 6/6] usb: musb: Fix runtime PM imbalance on error Bin Liu
5 siblings, 0 replies; 11+ messages in thread
From: Bin Liu @ 2020-05-25 2:50 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu
From: Paul Cercueil <paul@crapouillou.net>
The function dma_controller_irq() locks up the exact same spinlock we
locked before calling it, which obviously resulted in a deadlock when
CONFIG_SMP was enabled. This flew under the radar as none of the boards
supported by this driver needs SMP.
Fixes: 57aadb46bd63 ("usb: musb: jz4740: Add support for DMA")
Cc: stable@vger.kernel.org
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Bin Liu <b-liu@ti.com>
---
drivers/usb/musb/jz4740.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index e64dd30e80e7..c4fe1f4cd17a 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -30,11 +30,11 @@ static irqreturn_t jz4740_musb_interrupt(int irq, void *__hci)
irqreturn_t retval = IRQ_NONE, retval_dma = IRQ_NONE;
struct musb *musb = __hci;
- spin_lock_irqsave(&musb->lock, flags);
-
if (IS_ENABLED(CONFIG_USB_INVENTRA_DMA) && musb->dma_controller)
retval_dma = dma_controller_irq(irq, musb->dma_controller);
+ spin_lock_irqsave(&musb->lock, flags);
+
musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
--
2.17.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 6/6] usb: musb: Fix runtime PM imbalance on error
2020-05-25 2:50 [PATCH 0/6] musb patches for v5.8-rc1 Bin Liu
` (4 preceding siblings ...)
2020-05-25 2:50 ` [PATCH 5/6] usb: musb: jz4740: Prevent lockup when CONFIG_SMP is set Bin Liu
@ 2020-05-25 2:50 ` Bin Liu
5 siblings, 0 replies; 11+ messages in thread
From: Bin Liu @ 2020-05-25 2:50 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-usb, Bin Liu
From: Dinghao Liu <dinghao.liu@zju.edu.cn>
When copy_from_user() returns an error code, there
is a runtime PM usage counter imbalance.
Fix this by moving copy_from_user() to the beginning
of this function.
Fixes: 7b6c1b4c0e1e ("usb: musb: fix runtime PM in debugfs")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Bin Liu <b-liu@ti.com>
---
drivers/usb/musb/musb_debugfs.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
index 7b6281ab62ed..30a89aa8a3e7 100644
--- a/drivers/usb/musb/musb_debugfs.c
+++ b/drivers/usb/musb/musb_debugfs.c
@@ -168,6 +168,11 @@ static ssize_t musb_test_mode_write(struct file *file,
u8 test;
char buf[24];
+ memset(buf, 0x00, sizeof(buf));
+
+ if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
+ return -EFAULT;
+
pm_runtime_get_sync(musb->controller);
test = musb_readb(musb->mregs, MUSB_TESTMODE);
if (test) {
@@ -176,11 +181,6 @@ static ssize_t musb_test_mode_write(struct file *file,
goto ret;
}
- memset(buf, 0x00, sizeof(buf));
-
- if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
- return -EFAULT;
-
if (strstarts(buf, "force host full-speed"))
test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS;
--
2.17.1
^ permalink raw reply related [flat|nested] 11+ messages in thread