[PATCH 15/50] staging: vchi: Unify struct shim_service and struct vchi_service_handle

Dan Carpenter dan.carpenter at oracle.com
Wed Jun 24 10:11:41 EDT 2020


On Tue, Jun 23, 2020 at 06:42:01PM +0200, Nicolas Saenz Julienne wrote:
> @@ -437,12 +432,10 @@ static void service_free(struct shim_service *service)
>  
>  int32_t vchi_service_open(struct vchiq_instance *instance,
>  	struct service_creation *setup,
> -	struct vchi_service_handle **handle)
> +	struct vchi_service **service)
>  {
> -	struct shim_service *service = service_alloc(instance, setup);
> -
> -	*handle = (struct vchi_service_handle *)service;
>  
> +	*service = service_alloc(instance, setup);
>  	if (service) {

This should be checking "*service".

>  		struct vchiq_service_params params;
>  		enum vchiq_status status;
> @@ -450,27 +443,25 @@ int32_t vchi_service_open(struct vchiq_instance *instance,
>  		memset(&params, 0, sizeof(params));
>  		params.fourcc = setup->service_id;
>  		params.callback = shim_callback;
> -		params.userdata = service;
> +		params.userdata = *service;
>  		params.version = setup->version.version;
>  		params.version_min = setup->version.version_min;
>  
>  		status = vchiq_open_service(instance, &params,
> -			&service->handle);
> +			&((*service)->handle));
>  		if (status != VCHIQ_SUCCESS) {
> -			service_free(service);
> -			service = NULL;
> -			*handle = NULL;
> +			service_free(*service);
> +			*service = NULL;
>  		}
>  	}
>  
> -	return service ? 0 : -1;
> +	return *service ? 0 : -1;
>  }
>  EXPORT_SYMBOL(vchi_service_open);
>  

regards,
dan carpenter



More information about the linux-rpi-kernel mailing list