> > + /*
> > + * SVN was already up-to-date. This is the most
> > + * common case.
> > + */
> > + if (ret == SGX_NO_UPDATE)
> > + return 0;
> > +
> > + /*
> > + * SVN update failed due to lack of entropy in DRNG.
> > + * Indicate to userspace that it should retry.
> > + */
> > + if (ret == SGX_INSUFFICIENT_ENTROPY)
> > + return -EAGAIN;
> > +
> > + if (!ret) {
> > + /*
> > + * SVN successfully updated.
> > + * Let users know when the update was successful.
> > + */
> > + pr_info("SVN updated successfully\n");
> > + return 0;
> > + }
> > +
> > + /*
> > + * EUPDATESVN was called when EPC is empty, all other error
> > + * codes are unexpected.
> > + */
> > + ENCLS_WARN(ret, "EUPDATESVN");
> > + return -EIO;
> > +}
>
> Even if unlikely() was not used I still don't agree with the order i.e.,
> dealing with the success case in the middle. So I stand with my earlier
> suggestion, except unlikely() (since that was a problem for David, not
> going to fight over it).
I can change the order in the next patch if this is what everyone agrees on.
So, your preference would be to have smth like this:
+ /*
+ * SVN successfully updated.
+ * Let users know when the update was successful.
+ */
+ if (!ret)
+ pr_info("SVN updated successfully\n");
+
+ if (!ret) || (ret == SGX_NO_UPDATE)
+ return 0;
+
+ /*
+ * SVN update failed due to lack of entropy in DRNG.
+ * Indicate to userspace that it should retry.
+ */
+ if (ret == SGX_INSUFFICIENT_ENTROPY)
+ return -EAGAIN;
+
+ /*
+ * EUPDATESVN was called when EPC is empty, all other error
+ * codes are unexpected.
+ */
+ ENCLS_WARN(ret, "EUPDATESVN");
+ return -EIO;