libceph: remove unnecessary ret variable in ceph_auth_init()
authorzuoqilin <zuoqilin@yulong.com>
Thu, 10 Jun 2021 09:45:05 +0000 (17:45 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 28 Jun 2021 21:49:25 +0000 (23:49 +0200)
There is no necessary to define variable assignment, just return
directly to simplify the steps.

Signed-off-by: zuoqilin <zuoqilin@yulong.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
net/ceph/auth.c

index d2b268a1838e8e24864f049f20befd129d11965f..d38c9eadbe2f188d7f23fe7b2e8cfbf3c1411dc1 100644 (file)
@@ -58,12 +58,10 @@ struct ceph_auth_client *ceph_auth_init(const char *name,
                                        const int *con_modes)
 {
        struct ceph_auth_client *ac;
-       int ret;
 
-       ret = -ENOMEM;
        ac = kzalloc(sizeof(*ac), GFP_NOFS);
        if (!ac)
-               goto out;
+               return ERR_PTR(-ENOMEM);
 
        mutex_init(&ac->mutex);
        ac->negotiating = true;
@@ -78,9 +76,6 @@ struct ceph_auth_client *ceph_auth_init(const char *name,
        dout("%s name '%s' preferred_mode %d fallback_mode %d\n", __func__,
             ac->name, ac->preferred_mode, ac->fallback_mode);
        return ac;
-
-out:
-       return ERR_PTR(ret);
 }
 
 void ceph_auth_destroy(struct ceph_auth_client *ac)