[dpdk-dev,04/53] net/sfc/base: simplify verify result handling

Message ID 1510819481-6809-5-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Andrew Rybchenko Nov. 16, 2017, 8:03 a.m. UTC
  From: Andy Moreton <amoreton@solarflare.com>

Simplify verify result handling in NVRAM update finish

Signed-off-by: Andy Moreton <amoreton@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/efx_nvram.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
  

Patch

diff --git a/drivers/net/sfc/base/efx_nvram.c b/drivers/net/sfc/base/efx_nvram.c
index 14ff829..7d4c9a0 100644
--- a/drivers/net/sfc/base/efx_nvram.c
+++ b/drivers/net/sfc/base/efx_nvram.c
@@ -944,24 +944,23 @@  efx_mcdi_nvram_update_finish(
 		goto fail1;
 	}
 
-	if (encp->enc_fw_verified_nvram_update_required == B_FALSE) {
-		/* Report success if verified updates are not supported. */
-		result = MC_CMD_NVRAM_VERIFY_RC_SUCCESS;
-	} else {
-		/* Firmware-verified NVRAM updates are required */
-		if (req.emr_out_length_used <
-		    MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT_LEN) {
+	if (req.emr_out_length_used < MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT_LEN) {
+		result = MC_CMD_NVRAM_VERIFY_RC_UNKNOWN;
+		if (encp->enc_fw_verified_nvram_update_required) {
+			/* Mandatory verification result is missing */
 			rc = EMSGSIZE;
 			goto fail2;
 		}
+	} else {
 		result =
 		    MCDI_OUT_DWORD(req, NVRAM_UPDATE_FINISH_V2_OUT_RESULT_CODE);
+	}
 
-		if (result != MC_CMD_NVRAM_VERIFY_RC_SUCCESS) {
-			/* Mandatory verification failed */
-			rc = EINVAL;
-			goto fail3;
-		}
+	if ((encp->enc_fw_verified_nvram_update_required) &&
+	    (result != MC_CMD_NVRAM_VERIFY_RC_SUCCESS)) {
+		/* Mandatory verification failed */
+		rc = EINVAL;
+		goto fail3;
 	}
 
 	if (resultp != NULL)