lkml.org 
[lkml]   [2014]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 2/2] staging: android: ion: One function call less in ion_buffer_create() after error detection
    From: Markus Elfring <elfring@users.sourceforge.net>
    Date: Sun, 23 Nov 2014 19:12:29 +0100

    The jump label "err1" was used by the ion_buffer_create() function in case of
    a memory allocation failure just to pass a null pointer to a vfree() function
    call by a data structure element.
    This implementation detail could be improved by the deletion of this
    inappropriate jump label.

    Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
    ---
    drivers/staging/android/ion/ion.c | 3 +--
    1 file changed, 1 insertion(+), 2 deletions(-)

    diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
    index df12cc3..7a26b85 100644
    --- a/drivers/staging/android/ion/ion.c
    +++ b/drivers/staging/android/ion/ion.c
    @@ -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 err2;
    }

    for_each_sg(table->sgl, sg, table->nents, i) {
    @@ -262,7 +262,6 @@ 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);
    err2:
    kfree(buffer);
    --
    2.1.3


    \
     
     \ /
      Last update: 2014-11-23 20:21    [W:5.306 / U:0.576 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site