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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Oliver,

Thanks for your review.

> From: Oliver Neukum <oneukum@xxxxxxxx>
> 
> 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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux