Ignore:
Timestamp:
Oct 10, 2020, 5:27:12 PM (4 years ago)
Author:
alain
Message:

Cosmetic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/remote_buf.c

    r657 r666  
    3131#include <remote_buf.h>
    3232
    33 ///////////////////////////////////////////
    34 error_t remote_buf_create( xptr_t   buf_xp,
    35                            uint32_t size )
     33/////////////////////////////////////////
     34error_t remote_buf_init( xptr_t   buf_xp,
     35                         uint32_t size )
    3636{
    3737    kmem_req_t     req;
     
    4242
    4343    // allocate the data buffer
    44     if( size >= CONFIG_PPM_PAGE_SIZE )
     44    if( size == 0 )
     45    {
     46        data = NULL;
     47    }
     48    else if( size >= CONFIG_PPM_PAGE_SIZE )
    4549    {
    4650        req.type  = KMEM_PPM;
     
    4852        req.flags = AF_NONE;
    4953        data = kmem_remote_alloc( buf_cxy , &req );
     54
     55        if( data == NULL )  return -1;
    5056    }
    5157    else
     
    5561        req.flags = AF_NONE;
    5662        data = kmem_remote_alloc( buf_cxy , &req );
    57     }
    58 
    59     if( data == NULL )  return -1;
     63
     64        if( data == NULL )  return -1;
     65    }
    6066
    6167    // initialize buffer descriptor
     
    6874    return 0;
    6975
    70 }  // end remote_buf_create()
     76}  // end remote_buf_init()
    7177
    7278/////////////////////////////////////////
     
    7884    cxy_t          buf_cxy = GET_CXY( buf_xp );
    7985
    80     // release memory allocated to data buffer
    81     if( buf_ptr->size >= CONFIG_PPM_PAGE_SIZE )
     86    uint32_t size = hal_remote_l32( XPTR( buf_cxy , &buf_ptr->size ));
     87
     88    // release memory allocated to data buffer if required
     89    if( size == 0 )
     90    {
     91        return;
     92    }
     93    else if( size >= CONFIG_PPM_PAGE_SIZE )
    8294    {
    8395        req.type  = KMEM_PPM;
Note: See TracChangeset for help on using the changeset viewer.