Hi

On Thu, Oct 8, 2015 at 1:32 PM, Sergei Zviagintsev <[email protected]> wrote:
>  - Move `r' and `ret' to scopes where they are used. Drop redundant
>    initialization of `ret'.
>
>  - Initialize `bus' on declaration.
>
>  - Replace list_for_each_entry_safe() with list_for_each_entry() when
>    iterating over list of replies.
>
>  - Drop redundant `continue'.
>
> Signed-off-by: Sergei Zviagintsev <[email protected]>
> ---
>  ipc/kdbus/connection.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c
> index b32b4f981618..6ee688d3de53 100644
> --- a/ipc/kdbus/connection.c
> +++ b/ipc/kdbus/connection.c
> @@ -1293,25 +1293,24 @@ void kdbus_conn_move_messages(struct kdbus_conn 
> *conn_dst,
>                               u64 name_id)
>  {
>         struct kdbus_queue_entry *e, *e_tmp;
> -       struct kdbus_reply *r, *r_tmp;
> -       struct kdbus_bus *bus;
> +       struct kdbus_bus *bus = conn_src->ep->bus;
>         struct kdbus_conn *c;
>         LIST_HEAD(msg_list);
> -       int i, ret = 0;
> +       int i;
>
>         if (WARN_ON(conn_src == conn_dst))
>                 return;
>
> -       bus = conn_src->ep->bus;
> -
>         /* lock order: domain -> bus -> ep -> names -> conn */
>         down_read(&bus->conn_rwlock);
>         hash_for_each(bus->conn_hash, i, c, hentry) {
> +               struct kdbus_reply *r;
> +

Why make 'r' local?

>                 if (c == conn_src || c == conn_dst)
>                         continue;
>
>                 mutex_lock(&c->lock);
> -               list_for_each_entry_safe(r, r_tmp, &c->reply_list, entry) {
> +               list_for_each_entry(r, &c->reply_list, entry) {

Looks good.

>                         if (r->reply_src != conn_src)
>                                 continue;
>
> @@ -1328,6 +1327,8 @@ void kdbus_conn_move_messages(struct kdbus_conn 
> *conn_dst,
>
>         kdbus_conn_lock2(conn_src, conn_dst);
>         list_for_each_entry_safe(e, e_tmp, &conn_src->queue.msg_list, entry) {
> +               int ret;
> +

Why make it local?

>                 /* filter messages for a specific name */
>                 if (name_id > 0 && e->dst_name_id != name_id)
>                         continue;
> @@ -1343,7 +1344,6 @@ void kdbus_conn_move_messages(struct kdbus_conn 
> *conn_dst,
>                 if (ret < 0) {
>                         kdbus_conn_lost_message(conn_dst);
>                         kdbus_queue_entry_free(e);
> -                       continue;

Looks good.

Thanks
David

>                 }
>         }
>         kdbus_conn_unlock2(conn_src, conn_dst);
> --
> 1.8.3.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to