Perhaps we should set `ret` to something a little more descriptive (at least -EINVAL).  Same for the nonpersist case above.  We can change this for now by initializing ret properly above instead of to -1.