Commit 001943e8 authored by Narcisa Ana Maria Vasile's avatar Narcisa Ana Maria Vasile Committed by Greg Kroah-Hartman
Browse files

staging: vc04_services: Refactor conditionals



Refactor conditionals to reduce one level of indentation and improve
code readability.

Signed-off-by: default avatarNarcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 41831482
Loading
Loading
Loading
Loading
+109 −113
Original line number Diff line number Diff line
@@ -2574,9 +2574,14 @@ vchiq_add_service_internal(VCHIQ_STATE_T *state,
	VCHIQ_INSTANCE_T instance, VCHIQ_USERDATA_TERM_T userdata_term)
{
	VCHIQ_SERVICE_T *service;
	VCHIQ_SERVICE_T **pservice = NULL;
	VCHIQ_SERVICE_QUOTA_T *service_quota;
	int i;

	service = kmalloc(sizeof(VCHIQ_SERVICE_T), GFP_KERNEL);
	if (service) {
	if (!service)
		return service;

	service->base.fourcc   = params->fourcc;
	service->base.callback = params->callback;
	service->base.userdata = params->userdata;
@@ -2606,11 +2611,6 @@ vchiq_add_service_internal(VCHIQ_STATE_T *state,
	sema_init(&service->bulk_remove_event, 0);
	mutex_init(&service->bulk_mutex);
	memset(&service->stats, 0, sizeof(service->stats));
	}

	if (service) {
		VCHIQ_SERVICE_T **pservice = NULL;
		int i;

	/* Although it is perfectly possible to use service_spinlock
	** to protect the creation of services, it is overkill as it
@@ -2675,11 +2675,8 @@ vchiq_add_service_internal(VCHIQ_STATE_T *state,
		kfree(service);
		service = NULL;
	}
	}

	if (service) {
		VCHIQ_SERVICE_QUOTA_T *service_quota =
			&state->service_quotas[service->localport];
	service_quota = &state->service_quotas[service->localport];
	service_quota->slot_quota = state->default_slot_quota;
	service_quota->message_quota = state->default_message_quota;
	if (service_quota->slot_use_count == 0)
@@ -2696,7 +2693,6 @@ vchiq_add_service_internal(VCHIQ_STATE_T *state,
		? "Open" : "Add",
		VCHIQ_FOURCC_AS_4CHARS(params->fourcc),
		service->localport);
	}

	/* Don't unlock the service - leave it with a ref_count of 1. */