From: Sergei Zviagintsev <sergei@s15v.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Daniel Mack <daniel@zonque.org>,
David Herrmann <dh.herrmann@googlemail.com>,
Djalal Harouni <tixxdz@opendz.org>
Cc: linux-kernel@vger.kernel.org, Sergei Zviagintsev <sergei@s15v.net>
Subject: [PATCH 1/3] kdbus: kdbus_reply_find(): return on found entry
Date: Wed, 17 Jun 2015 20:14:56 +0300 [thread overview]
Message-ID: <1434561298-4576-2-git-send-email-sergei@s15v.net> (raw)
In-Reply-To: <1434561298-4576-1-git-send-email-sergei@s15v.net>
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 <sergei@s15v.net>
---
ipc/kdbus/reply.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
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
next prev parent reply other threads:[~2015-06-17 17:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-17 17:14 [PATCH 0/3] kdbus: minor readability improvements Sergei Zviagintsev
2015-06-17 17:14 ` Sergei Zviagintsev [this message]
2015-06-17 17:21 ` [PATCH 1/3] kdbus: kdbus_reply_find(): return on found entry David Herrmann
2015-06-17 17:14 ` [PATCH 2/3] kdbus: optimize error path in kdbus_reply_new() Sergei Zviagintsev
2015-06-17 17:25 ` David Herrmann
2015-06-17 17:14 ` [PATCH 3/3] kdbus: optimize if statements in kdbus_conn_disconnect() Sergei Zviagintsev
2015-06-17 17:27 ` David Herrmann
2015-06-17 17:45 ` [PATCH 0/3] kdbus: minor readability improvements Djalal Harouni
2015-06-17 19:03 ` Djalal Harouni
2015-06-19 5:07 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1434561298-4576-2-git-send-email-sergei@s15v.net \
--to=sergei@s15v.net \
--cc=daniel@zonque.org \
--cc=dh.herrmann@googlemail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tixxdz@opendz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®