Make gr_ep_enable fail properly when a call requests a larger ep.maxpacket than
ep.maxpacket_limit.
Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
        } 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);