Skip to contentSkip to conversation

staging: vchiq: remove braces from if block

PATCH New Gaston Gonzalez 1 participant 3 messages Sep 15, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 staging: vchiq: remove braces from if block

Remove unnecessary braces from if block.

Reported by checkpatch.pl

---
 .../vc04_services/interface/vchiq_arm/vchiq_connected.c        | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c +1 -2
index 83502f5f3a33..f367dbe2bc63 100644
@@ -17,9 +17,8 @@ static   DEFINE_MUTEX(g_connected_mutex);
 /* Function to initialize our lock */
 static void connected_init(void)
 {
-	if (!g_once_init) {
+	if (!g_once_init)
 		g_once_init = 1;
-	}
 }
 
 /*
Signature · 1 line
2.33.0
#1 lore raw

PATCH 2/3 staging: vchiq: add braces to if block

The rule of not using braces in single statement does not apply if only one branch of the conditional statement is a single statement. Add braces to fix this.

While at it, remove extra blank space after a comment inside the if block.

Reported by checkpatch.pl

---
 .../vc04_services/interface/vchiq_arm/vchiq_connected.c  | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c +4 -5
index f367dbe2bc63..1802fd5e4888 100644
@@ -34,16 +34,15 @@ void vchiq_add_connected_callback(void (*callback)(void))
 	if (mutex_lock_killable(&g_connected_mutex))
 		return;
 
-	if (g_connected)
+	if (g_connected) {
 		/* We're already connected. Call the callback immediately. */
-
 		callback();
-	else {
-		if (g_num_deferred_callbacks >= MAX_CALLBACKS)
+	} else {
+		if (g_num_deferred_callbacks >= MAX_CALLBACKS) {
 			vchiq_log_error(vchiq_core_log_level,
 				"There already %d callback registered - please increase MAX_CALLBACKS",
 				g_num_deferred_callbacks);
-		else {
+		} else {
 			g_deferred_callback[g_num_deferred_callbacks] =
 				callback;
 			g_num_deferred_callbacks++;
Signature · 1 line
2.33.0
#2 lore raw

PATCH 3/3 staging: vchiq: cleanup code alignment issues

In reply to Gaston Gonzalez

Fix code alignment issues.

Reported by checkpatch.pl

---
 .../vc04_services/interface/vchiq_arm/vchiq_connected.c       | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c +2 -2
index 1802fd5e4888..bdb0ab617d8b 100644
@@ -40,8 +40,8 @@ void vchiq_add_connected_callback(void (*callback)(void))
 	} else {
 		if (g_num_deferred_callbacks >= MAX_CALLBACKS) {
 			vchiq_log_error(vchiq_core_log_level,
-				"There already %d callback registered - please increase MAX_CALLBACKS",
-				g_num_deferred_callbacks);
+					"There already %d callback registered - please increase MAX_CALLBACKS",
+					g_num_deferred_callbacks);
 		} else {
 			g_deferred_callback[g_num_deferred_callbacks] =
 				callback;
Signature · 1 line
2.33.0