Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 3afcf68 in mainline


Ignore:
Timestamp:
2017-10-16T11:37:01Z (3 years ago)
Author:
Michal Staruch <salmelu@…>
Branches:
master
Children:
f971e957
Parents:
b7db009
Message:

Removed unnecessary malloc and forced bounds for async transfer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_usb.c

    rb7db009 r3afcf68  
    463463        }
    464464
    465         void *buffer = malloc(sizeof(usb_endpoint_desc_t));
    466         if (!buffer) {
    467                 async_answer_0(callid, ENOMEM);
    468                 return;
    469         }
    470 
     465        void *buffer = NULL;
    471466        size_t size = 0;
    472467        int rc = async_data_write_accept(&buffer, false,
    473                 1, sizeof(usb_endpoint_desc_t), 0, &size);
     468                sizeof(usb_endpoint_desc_t), sizeof(usb_endpoint_desc_t), 0, &size);
    474469
    475470        if (rc != EOK) {
     
    500495        }
    501496
    502         void *buffer = malloc(sizeof(usb_endpoint_desc_t));
    503         if (!buffer) {
    504                 async_answer_0(callid, ENOMEM);
    505                 return;
    506         }
    507 
     497        void *buffer = NULL;
    508498        size_t size = 0;
    509499        int rc = async_data_write_accept(&buffer, false,
    510                 1, sizeof(usb_endpoint_desc_t), 0, &size);
     500                sizeof(usb_endpoint_desc_t), sizeof(usb_endpoint_desc_t), 0, &size);
    511501
    512502        if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.