summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ganesh Mahendran <opensource.ganesh@gmail.com> 2017-10-11 18:05:13 +0800
committer Ganesh Mahendran <opensource.ganesh@gmail.com> 2017-10-11 18:05:13 +0800
commit58e5daaed8b446bdcf937a5eb368d6623d33f423 (patch)
tree03dadce41c2ea8c844324fabd000f4389bccae75
parent2560692961211fe25857fea729ad8d839619bb4e (diff)
binder: remove unnecessary err check
In function IPCThreadState::transact(), data.errorCheck() will be executed twice. Since IPCThreadState::transact() is the critical path for binder call, it is better to do data.errorCheck() once. This patch removes the first check at the beginning of IPCThreadState::transact(), the effect of this change is that LOG_ONEWAY(...) will be executed in error case("data.errorCheck() != NO_ERROR") I think this is not a problem. As "data.errorCheck() == NO_ERROR" is the normal case(which will execute LOG_ONEWAY()), and even in error case, we print a log about src/dst pid is not a bad idea. Change-Id: I7b892a2294774c55ce0df56edee6a820f82c6f13 Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
-rw-r--r--libs/binder/IPCThreadState.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index 1c3fab4057..ba9bf61f8c 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -571,7 +571,7 @@ status_t IPCThreadState::transact(int32_t handle,
uint32_t code, const Parcel& data,
Parcel* reply, uint32_t flags)
{
- status_t err = data.errorCheck();
+ status_t err;
flags |= TF_ACCEPT_FDS;
@@ -582,11 +582,9 @@ status_t IPCThreadState::transact(int32_t handle,
<< indent << data << dedent << endl;
}
- if (err == NO_ERROR) {
- LOG_ONEWAY(">>>> SEND from pid %d uid %d %s", getpid(), getuid(),
- (flags & TF_ONE_WAY) == 0 ? "READ REPLY" : "ONE WAY");
- err = writeTransactionData(BC_TRANSACTION, flags, handle, code, data, NULL);
- }
+ LOG_ONEWAY(">>>> SEND from pid %d uid %d %s", getpid(), getuid(),
+ (flags & TF_ONE_WAY) == 0 ? "READ REPLY" : "ONE WAY");
+ err = writeTransactionData(BC_TRANSACTION, flags, handle, code, data, NULL);
if (err != NO_ERROR) {
if (reply) reply->setError(err);