Skip to content

Commit 8dcbb9c

Browse files
committed
Revert "USB: gadget: f_hid: avoid crashes and log spam"
This reverts commit a6e47d5.
1 parent cd04fbf commit 8dcbb9c

1 file changed

Lines changed: 3 additions & 17 deletions

File tree

‎drivers/usb/gadget/function/f_hid.c‎

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,6 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer,
338338

339339
spin_lock_irqsave(&hidg->write_spinlock, flags);
340340

341-
if (!hidg->req) {
342-
spin_unlock_irqrestore(&hidg->write_spinlock, flags);
343-
return -ESHUTDOWN;
344-
}
345-
346341
#define WRITE_COND (!hidg->write_pending)
347342
try_again:
348343
/* write queue */
@@ -363,13 +358,7 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer,
363358
count = min_t(unsigned, count, hidg->report_length);
364359

365360
spin_unlock_irqrestore(&hidg->write_spinlock, flags);
366-
if (req) {
367-
status = copy_from_user(req->buf, buffer, count);
368-
} else {
369-
ERROR(hidg->func.config->cdev, "hidg->req is NULL\n");
370-
status = -ESHUTDOWN;
371-
goto release_write_pending;
372-
}
361+
status = copy_from_user(req->buf, buffer, count);
373362

374363
if (status != 0) {
375364
ERROR(hidg->func.config->cdev,
@@ -398,13 +387,10 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer,
398387

399388
spin_unlock_irqrestore(&hidg->write_spinlock, flags);
400389

401-
if (!hidg->in_ep->enabled) {
402-
ERROR(hidg->func.config->cdev, "in_ep is disabled\n");
403-
status = -ESHUTDOWN;
404-
goto release_write_pending;
405-
}
406390
status = usb_ep_queue(hidg->in_ep, req, GFP_ATOMIC);
407391
if (status < 0) {
392+
ERROR(hidg->func.config->cdev,
393+
"usb_ep_queue error on int endpoint %zd\n", status);
408394
goto release_write_pending;
409395
} else {
410396
status = count;

0 commit comments

Comments
 (0)