All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/ceph: Remove unnecessary variables
@ 2021-06-10  9:45 zuoqilin1
  2021-06-14 17:17 ` Ilya Dryomov
  0 siblings, 1 reply; 2+ messages in thread
From: zuoqilin1 @ 2021-06-10  9:45 UTC (permalink / raw)
  To: idryomov, jlayton, davem, kuba; +Cc: ceph-devel, netdev, linux-kernel, zuoqilin

From: zuoqilin <zuoqilin@yulong.com>

There is no necessary to define variable assignment,
just return directly to simplify the steps.

Signed-off-by: zuoqilin <zuoqilin@yulong.com>
---
 net/ceph/auth.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/net/ceph/auth.c b/net/ceph/auth.c
index de407e8..b824a48 100644
--- a/net/ceph/auth.c
+++ b/net/ceph/auth.c
@@ -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)
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/ceph: Remove unnecessary variables
  2021-06-10  9:45 [PATCH] net/ceph: Remove unnecessary variables zuoqilin1
@ 2021-06-14 17:17 ` Ilya Dryomov
  0 siblings, 0 replies; 2+ messages in thread
From: Ilya Dryomov @ 2021-06-14 17:17 UTC (permalink / raw)
  To: zuoqilin1
  Cc: Jeff Layton, David S. Miller, Jakub Kicinski, Ceph Development,
	netdev, LKML, zuoqilin

On Thu, Jun 10, 2021 at 12:02 PM <zuoqilin1@163.com> wrote:
>
> From: zuoqilin <zuoqilin@yulong.com>
>
> There is no necessary to define variable assignment,
> just return directly to simplify the steps.
>
> Signed-off-by: zuoqilin <zuoqilin@yulong.com>
> ---
>  net/ceph/auth.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/net/ceph/auth.c b/net/ceph/auth.c
> index de407e8..b824a48 100644
> --- a/net/ceph/auth.c
> +++ b/net/ceph/auth.c
> @@ -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)

Applied.

Thanks,

                Ilya

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-14 17:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10  9:45 [PATCH] net/ceph: Remove unnecessary variables zuoqilin1
2021-06-14 17:17 ` Ilya Dryomov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.