Skip to contentSkip to conversation

staging: vc04_services: Remove unnecessary braces

PATCH Superseded Mihaela Muraru 2 participants 3 messages Oct 15, 2017 – Oct 21, 2017

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: vc04_services: Remove unnecessary braces

Remove unnecessary braces for single statements.

---
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(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +16 -10
index a96bae0..7b7cc5a 100644
@@ -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
Signature · 1 line
2.7.4
#1 lore raw
Quoted 7 lines · Mihaela Muraru

Remove unnecessary braces for single statements.

---
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

#2 lore raw
Quoted 9 lines · Greg Kroah-Hartman
Quoted 7 lines · Mihaela Muraru

Remove unnecessary braces for single statements.

---
Changes in v2:
- declare a local variable "platform_state" of type "struct vchiq_2835_state", to avoid the multiple cast.

Quoted 6 lines

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