Skip to contentSkip to conversation

staging: android: Clean up else statement from binder_send_failed_reply

PATCH Superseded Lucas Tanure 3 participants 4 messages Jul 13, 2014 – Jul 14, 2014 Staging

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 staging: android: Clean up else statement from binder_send_failed_reply

Kernel coding style. Remove useless else statement after return. Changes from v1 and v2: Fix warning for mixed declarations and code. Declaration of "struct binder_transaction *next" made outside of while, and initialized with NULL.

---
 drivers/staging/android/binder.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/staging/android/binder.c +14 -14
index 14714a6..574f529 100644
@@ -1183,6 +1183,7 @@ static void binder_send_failed_reply(struct binder_transaction *t,
 				     uint32_t error_code)
 {
 	struct binder_thread *target_thread;
+	struct binder_transaction *next = NULL;
 
 	BUG_ON(t->flags & TF_ONE_WAY);
 	while (1) {
@@ -1210,24 +1211,23 @@ static void binder_send_failed_reply(struct binder_transaction *t,
 					target_thread->return_error);
 			}
 			return;
-		} else {
-			struct binder_transaction *next = t->from_parent;
+		}
+		next = t->from_parent;
 
-			binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
-				     "send failed reply for transaction %d, target dead\n",
-				     t->debug_id);
+		binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
+			     "send failed reply for transaction %d, target dead\n",
+			     t->debug_id);
 
-			binder_pop_transaction(target_thread, t);
-			if (next == NULL) {
-				binder_debug(BINDER_DEBUG_DEAD_BINDER,
-					     "reply failed, no target thread at root\n");
-				return;
-			}
-			t = next;
+		binder_pop_transaction(target_thread, t);
+		if (next == NULL) {
 			binder_debug(BINDER_DEBUG_DEAD_BINDER,
-				     "reply failed, no target thread -- retry %d\n",
-				      t->debug_id);
+				     "reply failed, no target thread at root\n");
+			return;
 		}
+		t = next;
+		binder_debug(BINDER_DEBUG_DEAD_BINDER,
+			     "reply failed, no target thread -- retry %d\n",
+			      t->debug_id);
 	}
 }
 
Signature · 1 line
2.0.1
#1 lore raw
Quoted 4 lines · Lucas Tanure

Kernel coding style. Remove useless else statement after return. Changes from v1 and v2: Fix warning for mixed declarations and code. Declaration of "struct binder_transaction *next" made outside of while, and initialized with NULL.

Why did you initialize it with NULL? It's not needed to do this, right?

4th time's a charm?

thanks,

greg k-h

#2 lore raw

Ok. I will do it.
4th could be the right one =p.

Thanks for your time
Cheers

--
Lucas Tanure
+55 (19) 988176559

Quoted 13 lines · Greg Kroah-Hartman
Quoted 4 lines · Lucas Tanure

Kernel coding style. Remove useless else statement after return. Changes from v1 and v2: Fix warning for mixed declarations and code. Declaration of "struct binder_transaction *next" made outside of while, and initialized with NULL.

Why did you initialize it with NULL? It's not needed to do this, right?

4th time's a charm?

thanks,

greg k-h

#3 lore raw
In reply to Lucas Tanure
Quoted 4 lines · Lucas Tanure

Kernel coding style. Remove useless else statement after return. Changes from v1 and v2: Fix warning for mixed declarations and code. Declaration of "struct binder_transaction *next" made outside of while, and initialized with NULL.

Don't initialize it at all. It just disables GCC's builtin warning for using unitialized variables.

regards,
dan carpenter