On Wed, Feb 02, 2022 at 04:54:44PM -0700, Alex Williamson wrote: > I think the argument here is that there's no value to validating or > bounds checking the end state, which could be done in the core ioctl > before calling the driver if the first iteration will already fail for > both the end state and the full path validation. Yes, I had a version like this in an internal draft, it was something like this: if (vfio_mig_get_next_state(vdev, set_state.device_state, set_state.device_state) == VFIO_DEVICE_STATE_ERROR) return -EINVAL; Which is fully redundant with the driver, only does half the check and looks weird. > > Perhaps it is confusing using ERROR to indicate that > > vfio_mig_get_next_state() failed. Would you be happier with a -errno > > return? > > Yes, it's confusing to me that next_state() returns states that don't > become the device_state. Stuffing the next step back into cur_fsm and > using an errno for a bounds/validity/blocked-arc test would be a better > API. Thanks, OK Jason