[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOi1vP-OQFQ9-PmUnv_qO6Yy4iMKCWDXX+jupfKSZKYnHnb66w@mail.gmail.com>
Date: Tue, 12 Apr 2022 11:11:11 +0200
From: Ilya Dryomov <idryomov@...il.com>
To: Guo Zhengkui <guozhengkui@...o.com>
Cc: Jeff Layton <jlayton@...nel.org>, Xiubo Li <xiubli@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
"open list:CEPH COMMON CODE (LIBCEPH)" <ceph-devel@...r.kernel.org>,
"open list:NETWORKING [GENERAL]" <netdev@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
zhengkui_guo@...look.com
Subject: Re: [PATCH linux-next] net: ceph: use swap() macro instead of taking
tmp variable
On Tue, Apr 12, 2022 at 9:01 AM Guo Zhengkui <guozhengkui@...o.com> wrote:
>
> Fix the following coccicheck warning:
> net/ceph/crush/mapper.c:1077:8-9: WARNING opportunity for swap()
>
> by using swap() for the swapping of variable values and drop
> the tmp variable that is not needed any more.
>
> Signed-off-by: Guo Zhengkui <guozhengkui@...o.com>
> ---
> net/ceph/crush/mapper.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c
> index 7057f8db4f99..1daf95e17d67 100644
> --- a/net/ceph/crush/mapper.c
> +++ b/net/ceph/crush/mapper.c
> @@ -906,7 +906,6 @@ int crush_do_rule(const struct crush_map *map,
> int recurse_to_leaf;
> int wsize = 0;
> int osize;
> - int *tmp;
> const struct crush_rule *rule;
> __u32 step;
> int i, j;
> @@ -1073,9 +1072,7 @@ int crush_do_rule(const struct crush_map *map,
> memcpy(o, c, osize*sizeof(*o));
>
> /* swap o and w arrays */
> - tmp = o;
> - o = w;
> - w = tmp;
> + swap(o, w);
> wsize = osize;
> break;
>
> --
> 2.20.1
>
Applied.
Thanks,
Ilya
Powered by blists - more mailing lists