Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1715681 > unrolled thread

[PATCH 2/3] ecryptfs: Return an error code only as a constant in ecryptfs_add_global_auth_tok()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-08-19 19:00 +0200
Last post2017-08-19 19:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/3] ecryptfs: Return an error code only as a constant in  ecryptfs_add_global_auth_tok() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-19 19:00 +0200

#1715681 — [PATCH 2/3] ecryptfs: Return an error code only as a constant in ecryptfs_add_global_auth_tok()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-08-19 19:00 +0200
Subject[PATCH 2/3] ecryptfs: Return an error code only as a constant in ecryptfs_add_global_auth_tok()
Message-ID<ugfgl-3Iz-3@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 19 Aug 2017 17:51:53 +0200

* Return an error code without storing it in an intermediate variable.

* Delete the jump target "out" and the local variable "rc"
  which became unnecessary with this refactoring.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/ecryptfs/keystore.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index 0131b0547699..47c1fd73638d 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -2519,14 +2519,12 @@ ecryptfs_add_global_auth_tok(struct ecryptfs_mount_crypt_stat *mount_crypt_stat,
 			     char *sig, u32 global_auth_tok_flags)
 {
 	struct ecryptfs_global_auth_tok *new_auth_tok;
-	int rc = 0;
 
 	new_auth_tok = kmem_cache_zalloc(ecryptfs_global_auth_tok_cache,
 					GFP_KERNEL);
-	if (!new_auth_tok) {
-		rc = -ENOMEM;
-		goto out;
-	}
+	if (!new_auth_tok)
+		return -ENOMEM;
+
 	memcpy(new_auth_tok->sig, sig, ECRYPTFS_SIG_SIZE_HEX);
 	new_auth_tok->flags = global_auth_tok_flags;
 	new_auth_tok->sig[ECRYPTFS_SIG_SIZE_HEX] = '\0';
@@ -2534,7 +2532,6 @@ ecryptfs_add_global_auth_tok(struct ecryptfs_mount_crypt_stat *mount_crypt_stat,
 	list_add(&new_auth_tok->mount_crypt_stat_list,
 		 &mount_crypt_stat->global_auth_tok_list);
 	mutex_unlock(&mount_crypt_stat->global_auth_tok_list_mutex);
-out:
-	return rc;
+	return 0;
 }
 
-- 
2.14.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web