[PATCH v2 2/4] dma-buf/sync_file: rework fence storage in struct file

Chris Wilson chris at chris-wilson.co.uk
Fri Jul 1 13:19:59 UTC 2016


On Fri, Jul 01, 2016 at 10:05:05AM -0300, Gustavo Padovan wrote:
> @@ -333,16 +384,16 @@ static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
>  	if (!info.num_fences)
>  		goto no_fences;
>  
> -	if (info.num_fences < sync_file->num_fences)
> +	if (info.num_fences < num_fences)
>  		return -EINVAL;
>  
> -	size = sync_file->num_fences * sizeof(*fence_info);
> +	size = num_fences * sizeof(*fence_info);
>  	fence_info = kzalloc(size, GFP_KERNEL);

Does size get used elsewhere? Otherwise it would be safer to reduce this
to kcalloc(num_fences, sizeof(*fence_info), GFP_KERNEL)

>  	if (!fence_info)
>  		return -ENOMEM;
>  

> diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c
> index 5f57499..0638a06 100644
> --- a/drivers/staging/android/sync_debug.c
> +++ b/drivers/staging/android/sync_debug.c
> @@ -159,10 +159,15 @@ static void sync_print_sync_file(struct seq_file *s,
>  	int i;
>  
>  	seq_printf(s, "[%p] %s: %s\n", sync_file, sync_file->name,
> -		   sync_status_str(atomic_read(&sync_file->status)));
> -
> -	for (i = 0; i < sync_file->num_fences; ++i)
> -		sync_print_fence(s, sync_file->cbs[i].fence, true);
> +		   sync_status_str(!fence_is_signaled(sync_file->fence)));
> +
> +	if (fence_is_array(sync_file->fence)) {
> +		struct fence_array *array = to_fence_array(sync_file->fence);

checkpatch will complain about the missing line between decl and code
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the dri-devel mailing list