Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1541214 > unrolled thread

Re: [PATCH] staging: android: ion: return -ENOMEM in ion_cma_heap allocation failure

Started byLaura Abbott <labbott@redhat.com>
First post2016-12-13 17:10 +0100
Last post2016-12-17 13:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] staging: android: ion: return -ENOMEM in ion_cma_heap  allocation failure Laura Abbott <labbott@redhat.com> - 2016-12-13 17:10 +0100
    Re: [PATCH] staging: android: ion: return -ENOMEM in ion_cma_heap  allocation failure Jaewon Kim <jaewon31.kim@gmail.com> - 2016-12-17 13:10 +0100

#1541214 — Re: [PATCH] staging: android: ion: return -ENOMEM in ion_cma_heap allocation failure

FromLaura Abbott <labbott@redhat.com>
Date2016-12-13 17:10 +0100
SubjectRe: [PATCH] staging: android: ion: return -ENOMEM in ion_cma_heap allocation failure
Message-ID<sNXOp-3i2-13@gated-at.bofh.it>
On 12/08/2016 09:05 PM, Jaewon Kim wrote:
> Initial Commit 349c9e138551 ("gpu: ion: add CMA heap") returns -1 in allocation
> failure. The returned value is passed up to userspace through ioctl. So user can
> misunderstand error reason as -EPERM(1) rather than -ENOMEM(12).
> 
> This patch simply changed this to return -ENOMEM.
> 
> Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
> ---
>  drivers/staging/android/ion/ion_cma_heap.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c
> index 6c7de74..22b9582 100644
> --- a/drivers/staging/android/ion/ion_cma_heap.c
> +++ b/drivers/staging/android/ion/ion_cma_heap.c
> @@ -24,8 +24,6 @@
>  #include "ion.h"
>  #include "ion_priv.h"
>  
> -#define ION_CMA_ALLOCATE_FAILED -1
> -
>  struct ion_cma_heap {
>  	struct ion_heap heap;
>  	struct device *dev;
> @@ -59,7 +57,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
>  
>  	info = kzalloc(sizeof(struct ion_cma_buffer_info), GFP_KERNEL);
>  	if (!info)
> -		return ION_CMA_ALLOCATE_FAILED;
> +		return -ENOMEM;
>  
>  	info->cpu_addr = dma_alloc_coherent(dev, len, &(info->handle),
>  						GFP_HIGHUSER | __GFP_ZERO);
> @@ -88,7 +86,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
>  	dma_free_coherent(dev, len, info->cpu_addr, info->handle);
>  err:
>  	kfree(info);
> -	return ION_CMA_ALLOCATE_FAILED;
> +	return -ENOMEM;
>  }
>  
>  static void ion_cma_free(struct ion_buffer *buffer)
> 

Happy to see cleanup

Acked-by: Laura Abbott <labbott@redhat.com>

[toc] | [next] | [standalone]


#1543961

FromJaewon Kim <jaewon31.kim@gmail.com>
Date2016-12-17 13:10 +0100
Message-ID<sPlYl-10x-5@gated-at.bofh.it>
In reply to#1541214
2016-12-14 1:04 GMT+09:00 Laura Abbott <labbott@redhat.com>:
> On 12/08/2016 09:05 PM, Jaewon Kim wrote:
>> Initial Commit 349c9e138551 ("gpu: ion: add CMA heap") returns -1 in allocation
>> failure. The returned value is passed up to userspace through ioctl. So user can
>> misunderstand error reason as -EPERM(1) rather than -ENOMEM(12).
>>
>> This patch simply changed this to return -ENOMEM.
>>
>> Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
>> ---
>>  drivers/staging/android/ion/ion_cma_heap.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c
>> index 6c7de74..22b9582 100644
>> --- a/drivers/staging/android/ion/ion_cma_heap.c
>> +++ b/drivers/staging/android/ion/ion_cma_heap.c
>> @@ -24,8 +24,6 @@
>>  #include "ion.h"
>>  #include "ion_priv.h"
>>
>> -#define ION_CMA_ALLOCATE_FAILED -1
>> -
>>  struct ion_cma_heap {
>>       struct ion_heap heap;
>>       struct device *dev;
>> @@ -59,7 +57,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
>>
>>       info = kzalloc(sizeof(struct ion_cma_buffer_info), GFP_KERNEL);
>>       if (!info)
>> -             return ION_CMA_ALLOCATE_FAILED;
>> +             return -ENOMEM;
>>
>>       info->cpu_addr = dma_alloc_coherent(dev, len, &(info->handle),
>>                                               GFP_HIGHUSER | __GFP_ZERO);
>> @@ -88,7 +86,7 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
>>       dma_free_coherent(dev, len, info->cpu_addr, info->handle);
>>  err:
>>       kfree(info);
>> -     return ION_CMA_ALLOCATE_FAILED;
>> +     return -ENOMEM;
>>  }
>>
>>  static void ion_cma_free(struct ion_buffer *buffer)
>>
>
> Happy to see cleanup
>
> Acked-by: Laura Abbott <labbott@redhat.com>

Thank you Laura Abbott. I'm honored to get Ack from you. I looked many
patches of you.
I hope this patch to be mainlined.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web