RE: [PATCH v11 1/4] usb: Add support for Intel LJCA device

Wu, Wentong
2023-08-31T12:39:56Z

Hi Oliver,

Thanks for your review.

> From: Oliver Neukum <oneukum@suse.com>
>
> On 29.08.23 06:54, Wentong Wu wrote:
>
> > +static void ljca_recv(struct urb *urb) {
> > + struct ljca_msg *header = urb->transfer_buffer;
> > + struct ljca_adapter *adap = urb->context;
> > + int ret;
> > +
> > + if (urb->status) {
> > + /* sync/async unlink faults aren't errors */
> > + if (urb->status == -ENOENT || urb->status == -ECONNRESET ||
> > + urb->status == -ESHUTDOWN)
> > + return;
> > +
> > + dev_err(adap->dev, "recv urb error: %d\n", urb->status);
> > + goto resubmit;
> > + }
> > +
> > + if (header->len + sizeof(*header) != urb->actual_length)
> > + goto resubmit;
> > +
> > + if (header->flags & LJCA_ACK_FLAG)
> > + ljca_handle_cmd_ack(adap, header);
> > + else
> > + ljca_handle_event(adap, header);
> > +
> > +resubmit:
> > + ret = usb_submit_urb(urb, GFP_ATOMIC);
> > + if (ret)
> > + dev_err(adap->dev, "resubmit recv urb error %d\n", ret);
>
> This will detect an error if you get an unlucky timing with ljca_suspend().

Indeed, thanks, I will fix this in next version.

BR,
Wentong

> The correct test would be:
> if (ret && ret != -EPERM)
>
> HTH
> Oliver