All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] staging: android: Clean up else statement from binder_send_failed_reply
@ 2014-07-13 23:25 Lucas Tanure
  2014-07-14  0:13 ` Greg Kroah-Hartman
  2014-07-14  8:43 ` Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: Lucas Tanure @ 2014-07-13 23:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arve Hjønnevåg, devel, linux-kernel

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. 

Signed-off-by: Lucas Tanure <tanure@linux.com>
---
 drivers/staging/android/binder.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index 14714a6..574f529 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -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);
 	}
 }
 
-- 
2.0.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] staging: android: Clean up else statement from binder_send_failed_reply
  2014-07-13 23:25 [PATCH v3] staging: android: Clean up else statement from binder_send_failed_reply Lucas Tanure
@ 2014-07-14  0:13 ` Greg Kroah-Hartman
  2014-07-14  0:35   ` Lucas Tanure
  2014-07-14  8:43 ` Dan Carpenter
  1 sibling, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2014-07-14  0:13 UTC (permalink / raw)
  To: Lucas Tanure; +Cc: Arve Hjønnevåg, devel, linux-kernel

On Sun, Jul 13, 2014 at 08:25:13PM -0300, Lucas Tanure wrote:
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] staging: android: Clean up else statement from binder_send_failed_reply
  2014-07-14  0:13 ` Greg Kroah-Hartman
@ 2014-07-14  0:35   ` Lucas Tanure
  0 siblings, 0 replies; 4+ messages in thread
From: Lucas Tanure @ 2014-07-14  0:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Arve Hjønnevåg, devel, linux-kernel

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

Thanks for your time
Cheers

--
Lucas Tanure
+55 (19) 988176559


On Sun, Jul 13, 2014 at 9:13 PM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Sun, Jul 13, 2014 at 08:25:13PM -0300, Lucas Tanure wrote:
>> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] staging: android: Clean up else statement from binder_send_failed_reply
  2014-07-13 23:25 [PATCH v3] staging: android: Clean up else statement from binder_send_failed_reply Lucas Tanure
  2014-07-14  0:13 ` Greg Kroah-Hartman
@ 2014-07-14  8:43 ` Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2014-07-14  8:43 UTC (permalink / raw)
  To: Lucas Tanure
  Cc: Greg Kroah-Hartman, Arve Hjønnevåg, devel, linux-kernel

On Sun, Jul 13, 2014 at 08:25:13PM -0300, Lucas Tanure wrote:
> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-14  8:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-13 23:25 [PATCH v3] staging: android: Clean up else statement from binder_send_failed_reply Lucas Tanure
2014-07-14  0:13 ` Greg Kroah-Hartman
2014-07-14  0:35   ` Lucas Tanure
2014-07-14  8:43 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.