Hi Martin
There is a thread about the cancel function: https://community.nxp.com/thread/449726
It may be intended as part of clearing a stall (?)
If you are "sure" that the host is no longer sending IN tokens to the device there is no risk and queued data can be flush (but the prepared buffer descriptors also need to be cancelled). As noted, this means just resetting the OWN bits in the buffer descriptors so that they are no longer pending. Whether the USB device stack you are using can do it inherently is another question so if it doesn't support this you will need to add a function to do it.
Essentially is is not complicated since you just need to know where the endpoint's buffer descriptors are and reset the OWN flag in their control words (there will be one or two depending on the driver's operation and the amount prepared). Whether there are further complications will depend on the way that the driver queues its data and makes use of swap buffers and so whether anything here needs to be unwound in the firmware driver or not.
Regards
Mark