Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1235765 > unrolled thread
| Started by | Rohit kumar <rohit.kr@samsung.com> |
|---|---|
| First post | 2015-09-30 07:40 +0200 |
| Last post | 2015-10-01 08:40 +0200 |
| Articles | 4 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH 1/1] staging: ion: Fix error handling in ion_buffer_create Rohit kumar <rohit.kr@samsung.com> - 2015-09-30 07:40 +0200
Re: [PATCH 1/1] staging: ion: Fix error handling in ion_buffer_create Laura Abbott <labbott@redhat.com> - 2015-09-30 20:20 +0200
RE: [PATCH 1/1] staging: ion: Fix error handling in ion_buffer_create PINTU KUMAR <pintu.k@samsung.com> - 2015-10-01 07:40 +0200
Re: [PATCH 1/1] staging: ion: Fix error handling in ion_buffer_create Gioh Kim <gioh.kim@lge.com> - 2015-10-01 08:40 +0200
| From | Rohit kumar <rohit.kr@samsung.com> |
|---|---|
| Date | 2015-09-30 07:40 +0200 |
| Subject | [PATCH 1/1] staging: ion: Fix error handling in ion_buffer_create |
| Message-ID | <qeiht-44N-19@gated-at.bofh.it> |
This patch fixes error handling case when buffer->pages allocation
fails. Also, it removes unreachable code of checking ret variable
although it is not updated.
Signed-off-by: Rohit kumar <rohit.kr@samsung.com>
---
drivers/staging/android/ion/ion.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 217aa53..af59e4a 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -213,10 +213,10 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
"heap->ops->map_dma should return ERR_PTR on error"))
table = ERR_PTR(-EINVAL);
if (IS_ERR(table)) {
- heap->ops->free(buffer);
- kfree(buffer);
- return ERR_CAST(table);
+ ret = -EINVAL;
+ goto err1;
}
+
buffer->sg_table = table;
if (ion_buffer_fault_user_mappings(buffer)) {
int num_pages = PAGE_ALIGN(buffer->size) / PAGE_SIZE;
@@ -226,7 +226,7 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
buffer->pages = vmalloc(sizeof(struct page *) * num_pages);
if (!buffer->pages) {
ret = -ENOMEM;
- goto err1;
+ goto err;
}
for_each_sg(table->sgl, sg, table->nents, i) {
@@ -235,9 +235,6 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
for (j = 0; j < sg->length / PAGE_SIZE; j++)
buffer->pages[k++] = page++;
}
-
- if (ret)
- goto err;
}
buffer->dev = dev;
@@ -261,9 +258,8 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
err:
heap->ops->unmap_dma(heap, buffer);
- heap->ops->free(buffer);
err1:
- vfree(buffer->pages);
+ heap->ops->free(buffer);
err2:
kfree(buffer);
return ERR_PTR(ret);
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Laura Abbott <labbott@redhat.com> |
|---|---|
| Date | 2015-09-30 20:20 +0200 |
| Message-ID | <qeu8W-4ns-35@gated-at.bofh.it> |
| In reply to | #1235765 |
On 09/29/2015 10:37 PM, Rohit kumar wrote:
> This patch fixes error handling case when buffer->pages allocation
> fails. Also, it removes unreachable code of checking ret variable
> although it is not updated.
>
Reviewed-by: Laura Abbott <labbott@redhat.com>
> Signed-off-by: Rohit kumar <rohit.kr@samsung.com>
> ---
> drivers/staging/android/ion/ion.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index 217aa53..af59e4a 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -213,10 +213,10 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
> "heap->ops->map_dma should return ERR_PTR on error"))
> table = ERR_PTR(-EINVAL);
> if (IS_ERR(table)) {
> - heap->ops->free(buffer);
> - kfree(buffer);
> - return ERR_CAST(table);
> + ret = -EINVAL;
> + goto err1;
> }
> +
> buffer->sg_table = table;
> if (ion_buffer_fault_user_mappings(buffer)) {
> int num_pages = PAGE_ALIGN(buffer->size) / PAGE_SIZE;
> @@ -226,7 +226,7 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
> buffer->pages = vmalloc(sizeof(struct page *) * num_pages);
> if (!buffer->pages) {
> ret = -ENOMEM;
> - goto err1;
> + goto err;
> }
>
> for_each_sg(table->sgl, sg, table->nents, i) {
> @@ -235,9 +235,6 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
> for (j = 0; j < sg->length / PAGE_SIZE; j++)
> buffer->pages[k++] = page++;
> }
> -
> - if (ret)
> - goto err;
> }
>
> buffer->dev = dev;
> @@ -261,9 +258,8 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
>
> err:
> heap->ops->unmap_dma(heap, buffer);
> - heap->ops->free(buffer);
> err1:
> - vfree(buffer->pages);
> + heap->ops->free(buffer);
> err2:
> kfree(buffer);
> return ERR_PTR(ret);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | PINTU KUMAR <pintu.k@samsung.com> |
|---|---|
| Date | 2015-10-01 07:40 +0200 |
| Message-ID | <qeEL0-2OG-5@gated-at.bofh.it> |
| In reply to | #1236622 |
> -----Original Message-----
> From: Laura Abbott [mailto:labbott@redhat.com]
> Sent: Wednesday, September 30, 2015 11:42 PM
> To: Rohit kumar; gregkh@linuxfoundation.org; arve@android.com;
> riandrews@android.com; dan.carpenter@oracle.com;
> sumit.semwal@linaro.org; mitchelh@codeaurora.org; akpm@linux-
> foundation.org; linux@rasmusvillemoes.dk; dmitry.kalinkin@gmail.com;
> elfring@users.sourceforge.net; gioh.kim@lge.com; devel@driverdev.osuosl.org;
> linux-kernel@vger.kernel.org
> Cc: pintu.k@samsung.com; me.rohit@live.com; pintu_agarwal@yahoo.com;
> c.rajkumar@samsung.com; sreenathd@samsung.com; cpgs@samsung.com;
> vishnu.ps@samsung.com
> Subject: Re: [PATCH 1/1] staging: ion: Fix error handling in ion_buffer_create
>
> On 09/29/2015 10:37 PM, Rohit kumar wrote:
> > This patch fixes error handling case when buffer->pages allocation
> > fails. Also, it removes unreachable code of checking ret variable
> > although it is not updated.
> >
>
> Reviewed-by: Laura Abbott <labbott@redhat.com>
>
> > Signed-off-by: Rohit kumar <rohit.kr@samsung.com>
> > ---
> > drivers/staging/android/ion/ion.c | 14 +++++---------
> > 1 file changed, 5 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/staging/android/ion/ion.c
> > b/drivers/staging/android/ion/ion.c
> > index 217aa53..af59e4a 100644
> > --- a/drivers/staging/android/ion/ion.c
> > +++ b/drivers/staging/android/ion/ion.c
> > @@ -213,10 +213,10 @@ static struct ion_buffer *ion_buffer_create(struct
> ion_heap *heap,
> > "heap->ops->map_dma should return ERR_PTR on
> error"))
> > table = ERR_PTR(-EINVAL);
> > if (IS_ERR(table)) {
> > - heap->ops->free(buffer);
> > - kfree(buffer);
> > - return ERR_CAST(table);
> > + ret = -EINVAL;
> > + goto err1;
> > }
> > +
> > buffer->sg_table = table;
> > if (ion_buffer_fault_user_mappings(buffer)) {
> > int num_pages = PAGE_ALIGN(buffer->size) / PAGE_SIZE; @@ -
> 226,7
> > +226,7 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
> > buffer->pages = vmalloc(sizeof(struct page *) * num_pages);
> > if (!buffer->pages) {
> > ret = -ENOMEM;
> > - goto err1;
> > + goto err;
> > }
> >
> > for_each_sg(table->sgl, sg, table->nents, i) { @@ -235,9 +235,6
> @@
> > static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
> > for (j = 0; j < sg->length / PAGE_SIZE; j++)
> > buffer->pages[k++] = page++;
> > }
> > -
> > - if (ret)
> > - goto err;
> > }
> >
> > buffer->dev = dev;
> > @@ -261,9 +258,8 @@ static struct ion_buffer *ion_buffer_create(struct
> > ion_heap *heap,
> >
> > err:
> > heap->ops->unmap_dma(heap, buffer);
> > - heap->ops->free(buffer);
> > err1:
> > - vfree(buffer->pages);
> > + heap->ops->free(buffer);
> > err2:
> > kfree(buffer);
> > return ERR_PTR(ret);
> >
Suggested-by: Pintu Kumar <pintu.k@samsung.com>
Reviewed-by: Pintu Kumar <pintu.k@samsung.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Gioh Kim <gioh.kim@lge.com> |
|---|---|
| Date | 2015-10-01 08:40 +0200 |
| Message-ID | <qeFH4-4bi-17@gated-at.bofh.it> |
| In reply to | #1236971 |
2015-10-01 오후 2:31에 PINTU KUMAR 이(가) 쓴 글:
>
>> -----Original Message-----
>> From: Laura Abbott [mailto:labbott@redhat.com]
>> Sent: Wednesday, September 30, 2015 11:42 PM
>> To: Rohit kumar; gregkh@linuxfoundation.org; arve@android.com;
>> riandrews@android.com; dan.carpenter@oracle.com;
>> sumit.semwal@linaro.org; mitchelh@codeaurora.org; akpm@linux-
>> foundation.org; linux@rasmusvillemoes.dk; dmitry.kalinkin@gmail.com;
>> elfring@users.sourceforge.net; gioh.kim@lge.com; devel@driverdev.osuosl.org;
>> linux-kernel@vger.kernel.org
>> Cc: pintu.k@samsung.com; me.rohit@live.com; pintu_agarwal@yahoo.com;
>> c.rajkumar@samsung.com; sreenathd@samsung.com; cpgs@samsung.com;
>> vishnu.ps@samsung.com
>> Subject: Re: [PATCH 1/1] staging: ion: Fix error handling in ion_buffer_create
>>
>> On 09/29/2015 10:37 PM, Rohit kumar wrote:
>>> This patch fixes error handling case when buffer->pages allocation
>>> fails. Also, it removes unreachable code of checking ret variable
>>> although it is not updated.
>>>
>>
>> Reviewed-by: Laura Abbott <labbott@redhat.com>
>>
>>> Signed-off-by: Rohit kumar <rohit.kr@samsung.com>
>>> ---
>>> drivers/staging/android/ion/ion.c | 14 +++++---------
>>> 1 file changed, 5 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/drivers/staging/android/ion/ion.c
>>> b/drivers/staging/android/ion/ion.c
>>> index 217aa53..af59e4a 100644
>>> --- a/drivers/staging/android/ion/ion.c
>>> +++ b/drivers/staging/android/ion/ion.c
>>> @@ -213,10 +213,10 @@ static struct ion_buffer *ion_buffer_create(struct
>> ion_heap *heap,
>>> "heap->ops->map_dma should return ERR_PTR on
>> error"))
>>> table = ERR_PTR(-EINVAL);
>>> if (IS_ERR(table)) {
>>> - heap->ops->free(buffer);
>>> - kfree(buffer);
>>> - return ERR_CAST(table);
>>> + ret = -EINVAL;
>>> + goto err1;
>>> }
>>> +
>>> buffer->sg_table = table;
>>> if (ion_buffer_fault_user_mappings(buffer)) {
>>> int num_pages = PAGE_ALIGN(buffer->size) / PAGE_SIZE; @@ -
>> 226,7
>>> +226,7 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
>>> buffer->pages = vmalloc(sizeof(struct page *) * num_pages);
>>> if (!buffer->pages) {
>>> ret = -ENOMEM;
>>> - goto err1;
>>> + goto err;
>>> }
>>>
>>> for_each_sg(table->sgl, sg, table->nents, i) { @@ -235,9 +235,6
>> @@
>>> static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
>>> for (j = 0; j < sg->length / PAGE_SIZE; j++)
>>> buffer->pages[k++] = page++;
>>> }
>>> -
>>> - if (ret)
>>> - goto err;
>>> }
>>>
>>> buffer->dev = dev;
>>> @@ -261,9 +258,8 @@ static struct ion_buffer *ion_buffer_create(struct
>>> ion_heap *heap,
>>>
>>> err:
>>> heap->ops->unmap_dma(heap, buffer);
>>> - heap->ops->free(buffer);
>>> err1:
>>> - vfree(buffer->pages);
>>> + heap->ops->free(buffer);
>>> err2:
>>> kfree(buffer);
>>> return ERR_PTR(ret);
>>>
>
> Suggested-by: Pintu Kumar <pintu.k@samsung.com>
> Reviewed-by: Pintu Kumar <pintu.k@samsung.com>
>
>
>
It's nice!
Reviewed-by: Gioh Kim <gioh.kim@lge.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web