[PATCH 05/11] staging: vchiq_arm: Rework second abort criterion

Stefan Wahren stefan.wahren at i2se.com
Sat Mar 31 13:09:41 PDT 2018


In order to make the code easier to review, move the second
abort criterion into the loop and the incrementation into
a separate line.

Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index f276437..aee721e 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -3449,7 +3449,7 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state)
 	if (active_services > ARRAY_SIZE(service_data))
 		only_nonzero = 1;
 
-	for (i = 0; (i < active_services) && (j < ARRAY_SIZE(service_data)); i++) {
+	for (i = 0; i < active_services; i++) {
 		VCHIQ_SERVICE_T *service_ptr = state->services[i];
 
 		if (!service_ptr)
@@ -3463,7 +3463,10 @@ vchiq_dump_service_use_state(VCHIQ_STATE_T *state)
 
 		service_data[j].fourcc = service_ptr->base.fourcc;
 		service_data[j].clientid = service_ptr->client_id;
-		service_data[j++].use_count = service_ptr->service_use_count;
+		service_data[j].use_count = service_ptr->service_use_count;
+		j++;
+		if (j >= ARRAY_SIZE(service_data))
+			break;
 	}
 
 	read_unlock_bh(&arm_state->susp_res_lock);
-- 
2.7.4




More information about the linux-rpi-kernel mailing list