return VCHIQ_ERROR;
}
+static int vchiq_validate_params(const struct vchiq_service_params *params)
+{
+ if (!params->callback || !params->fourcc) {
+ vchiq_loud_error("Can't add service, invalid params\n");
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
/* Called from application thread when a client or server service is created. */
struct vchiq_service *
vchiq_add_service_internal(struct vchiq_state *state,
struct vchiq_service *service;
struct vchiq_service __rcu **pservice = NULL;
struct vchiq_service_quota *service_quota;
+ int ret;
int i;
+ ret = vchiq_validate_params(params);
+ if (ret)
+ return NULL;
+
service = kmalloc(sizeof(*service), GFP_KERNEL);
if (!service)
return service;
struct vchi_service *service =
(struct vchi_service *)VCHIQ_GET_SERVICE_USERDATA(handle);
- if (!service->callback)
- goto release;
-
if (reason == VCHIQ_MESSAGE_AVAILABLE)
vchiu_queue_push(&service->queue, header);
service->callback(service->callback_param, reason, bulk_user);
-release:
return VCHIQ_SUCCESS;
}