Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757168AbbFQRWL (ORCPT ); Wed, 17 Jun 2015 13:22:11 -0400 Received: from mail-la0-f53.google.com ([209.85.215.53]:35663 "EHLO mail-la0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754163AbbFQRWA (ORCPT ); Wed, 17 Jun 2015 13:22:00 -0400 MIME-Version: 1.0 In-Reply-To: <1434561298-4576-2-git-send-email-sergei@s15v.net> References: <1434561298-4576-1-git-send-email-sergei@s15v.net> <1434561298-4576-2-git-send-email-sergei@s15v.net> Date: Wed, 17 Jun 2015 19:21:59 +0200 Message-ID: Subject: Re: [PATCH 1/3] kdbus: kdbus_reply_find(): return on found entry From: David Herrmann To: Sergei Zviagintsev Cc: Greg Kroah-Hartman , Daniel Mack , David Herrmann , Djalal Harouni , linux-kernel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1671 Lines: 53 Hi On Wed, Jun 17, 2015 at 7:14 PM, Sergei Zviagintsev wrote: > Return found entry immediately instead of assigning it to additional > variable and breaking the loop. It's simpler to read, the same way is > used in kdbus_conn_has_name(), for example. > > Signed-off-by: Sergei Zviagintsev > --- > ipc/kdbus/reply.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) Yeah, left-over from reply->mutex. Reviewed-by: David Herrmann Thanks David > diff --git a/ipc/kdbus/reply.c b/ipc/kdbus/reply.c > index 89d355b44f63..9d823ebee71f 100644 > --- a/ipc/kdbus/reply.c > +++ b/ipc/kdbus/reply.c > @@ -171,17 +171,15 @@ struct kdbus_reply *kdbus_reply_find(struct kdbus_conn *replying, > struct kdbus_conn *reply_dst, > u64 cookie) > { > - struct kdbus_reply *r, *reply = NULL; > + struct kdbus_reply *r; > > list_for_each_entry(r, &reply_dst->reply_list, entry) { > if (r->cookie == cookie && > - (!replying || r->reply_src == replying)) { > - reply = r; > - break; > - } > + (!replying || r->reply_src == replying)) > + return r; > } > > - return reply; > + return NULL; > } > > /** > -- > 1.8.3.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/