Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b38d27e5 authored by Andreas Larsson's avatar Andreas Larsson Committed by Felipe Balbi
Browse files

usb: gadget: gr_udc: Return error code when trying to set ep.maxpacket > ep.maxpacket_limit



Make gr_ep_enable fail properly when a call requests a larger ep.maxpacket than
ep.maxpacket_limit.

Signed-off-by: default avatarAndreas Larsson <andreas@gaisler.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 5bddbd72
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1542,6 +1542,10 @@ static int gr_ep_enable(struct usb_ep *_ep,
	} else if (max == 0) {
		dev_err(dev->dev, "Max payload cannot be set to 0\n");
		return -EINVAL;
	} else if (max > ep->ep.maxpacket_limit) {
		dev_err(dev->dev, "Requested max payload %d > limit %d\n",
			max, ep->ep.maxpacket_limit);
		return -EINVAL;
	}

	spin_lock(&ep->dev->lock);