All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: vc04_services: Remove unnecessary braces
@ 2017-10-15 19:00 Mihaela Muraru
  2017-10-18 14:14 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Mihaela Muraru @ 2017-10-15 19:00 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Eric Anholt, Stefan Wahren, Greg Kroah-Hartman

Remove unnecessary braces for single statements.

Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
---
Changes in v2:
	 - declare a local variable "platform_state" of type "struct
	 vchiq_2835_state", to avoid the multiple cast.

 .../interface/vchiq_arm/vchiq_2835_arm.c           | 26 +++++++++++++---------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index a96bae0..7b7cc5a 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -204,25 +204,31 @@ VCHIQ_STATUS_T
 vchiq_platform_init_state(VCHIQ_STATE_T *state)
 {
 	VCHIQ_STATUS_T status = VCHIQ_SUCCESS;
+	struct vchiq_2835_state *platform_state;
+
+	state->platform_state = kzalloc(sizeof(*platform_state), GFP_KERNEL);
+	platform_state = (struct vchiq_2835_state *)state->platform_state;
+
+	platform_state->inited = 1;
+	status = vchiq_arm_init_state(state, &platform_state->arm_state);
 
-	state->platform_state = kzalloc(sizeof(struct vchiq_2835_state), GFP_KERNEL);
-	((struct vchiq_2835_state *)state->platform_state)->inited = 1;
-	status = vchiq_arm_init_state(state, &((struct vchiq_2835_state *)state->platform_state)->arm_state);
 	if (status != VCHIQ_SUCCESS)
-	{
-		((struct vchiq_2835_state *)state->platform_state)->inited = 0;
-	}
+		platform_state->inited = 0;
+
 	return status;
 }
 
 VCHIQ_ARM_STATE_T*
 vchiq_platform_get_arm_state(VCHIQ_STATE_T *state)
 {
-	if (!((struct vchiq_2835_state *)state->platform_state)->inited)
-	{
+	struct vchiq_2835_state *platform_state;
+
+	platform_state   = (struct vchiq_2835_state *)state->platform_state;
+
+	if (!platform_state->inited)
 		BUG();
-	}
-	return &((struct vchiq_2835_state *)state->platform_state)->arm_state;
+
+	return &platform_state->arm_state;
 }
 
 void
-- 
2.7.4



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

* Re: [PATCH v2] staging: vc04_services: Remove unnecessary braces
  2017-10-15 19:00 [PATCH v2] staging: vc04_services: Remove unnecessary braces Mihaela Muraru
@ 2017-10-18 14:14 ` Greg Kroah-Hartman
  2017-10-21  6:17   ` Mihaela Muraru
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2017-10-18 14:14 UTC (permalink / raw)
  To: Mihaela Muraru; +Cc: outreachy-kernel, Eric Anholt, Stefan Wahren

On Sun, Oct 15, 2017 at 10:00:41PM +0300, Mihaela Muraru wrote:
> Remove unnecessary braces for single statements.
> 
> Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
> ---
> Changes in v2:
> 	 - declare a local variable "platform_state" of type "struct
> 	 vchiq_2835_state", to avoid the multiple cast.

This patch does a lot more than what the changelog says :(
Please describe everything in the changelog.

thanks,

greg k-h


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

* Re: [PATCH v2] staging: vc04_services: Remove unnecessary braces
  2017-10-18 14:14 ` Greg Kroah-Hartman
@ 2017-10-21  6:17   ` Mihaela Muraru
  0 siblings, 0 replies; 3+ messages in thread
From: Mihaela Muraru @ 2017-10-21  6:17 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Eric Anholt, Stefan Wahren, Greg Kroah-Hartman

On Wed, Oct 18, 2017 at 04:14:52PM +0200, Greg Kroah-Hartman wrote:
> On Sun, Oct 15, 2017 at 10:00:41PM +0300, Mihaela Muraru wrote:
> > Remove unnecessary braces for single statements.
> > 
> > Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
> > ---
> > Changes in v2:
> > 	 - declare a local variable "platform_state" of type "struct
> > 	 vchiq_2835_state", to avoid the multiple cast.
> 
> This patch does a lot more than what the changelog says :(
> Please describe everything in the changelog.
> 
> thanks,
> 
> greg k-h

Thank you,

I will send patch v3 with more information.

Mihaela


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

end of thread, other threads:[~2017-10-21  6:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-15 19:00 [PATCH v2] staging: vc04_services: Remove unnecessary braces Mihaela Muraru
2017-10-18 14:14 ` Greg Kroah-Hartman
2017-10-21  6:17   ` Mihaela Muraru

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.