[PATCH] crypto: octeontx - simplify get_{eng,ucode}_type_str helpers

Thorsten Blum posted 1 patch 12 hours ago
.../crypto/marvell/octeontx/otx_cptpf_ucode.c | 24 +++++++------------
1 file changed, 8 insertions(+), 16 deletions(-)
[PATCH] crypto: octeontx - simplify get_{eng,ucode}_type_str helpers
Posted by Thorsten Blum 12 hours ago
Remove the local variables, add default cases, and return the strings
directly.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 .../crypto/marvell/octeontx/otx_cptpf_ucode.c | 24 +++++++------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c b/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c
index 417a48f41350..6b74b4737421 100644
--- a/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c
+++ b/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c
@@ -103,34 +103,26 @@ static void set_ucode_filename(struct otx_cpt_ucode *ucode,
 
 static char *get_eng_type_str(int eng_type)
 {
-	char *str = "unknown";
-
 	switch (eng_type) {
 	case OTX_CPT_SE_TYPES:
-		str = "SE";
-		break;
-
+		return "SE";
 	case OTX_CPT_AE_TYPES:
-		str = "AE";
-		break;
+		return "AE";
+	default:
+		return "unknown";
 	}
-	return str;
 }
 
 static char *get_ucode_type_str(int ucode_type)
 {
-	char *str = "unknown";
-
 	switch (ucode_type) {
 	case (1 << OTX_CPT_SE_TYPES):
-		str = "SE";
-		break;
-
+		return "SE";
 	case (1 << OTX_CPT_AE_TYPES):
-		str = "AE";
-		break;
+		return "AE";
+	default:
+		return "unknown";
 	}
-	return str;
 }
 
 static int get_ucode_type(struct otx_cpt_ucode_hdr *ucode_hdr, int *ucode_type)