Changeset f4a42661 in mainline for uspace/drv/nic/ar9271/wmi.c


Ignore:
Timestamp:
2023-10-22T14:04:49Z (18 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
590cb6d2
Parents:
b2cbc0b (diff), c63c2bb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge fixes to issues found while updating toolchain

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/ar9271/wmi.c

    rb2cbc0b rf4a42661  
    230230        size_t buffer_size = header_size + command_length;
    231231        void *buffer = malloc(buffer_size);
     232        if (buffer == NULL) {
     233                usb_log_error("Failed to allocate WMI message buffer (out of memory).\n");
     234                return ENOMEM;
     235        }
    232236
    233237        if (command_buffer != NULL)
     
    241245            host2uint16_t_be(++htc_device->sequence_number);
    242246
    243         /* Send message. */
     247        /* Send message (buffer will not be needed afterwards regardless of result). */
    244248        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
    245249            htc_device->endpoints.wmi_endpoint);
    246         if (rc != EOK) {
    247                 free(buffer);
     250        free(buffer);
     251        if (rc != EOK) {
    248252                usb_log_error("Failed to send WMI message. Error: %s\n", str_error_name(rc));
    249253                return rc;
    250254        }
    251 
    252         free(buffer);
    253255
    254256        bool clean_resp_buffer = false;
     
    267269                    response_buffer_size, NULL);
    268270                if (rc != EOK) {
    269                         free(buffer);
    270271                        usb_log_error("Failed to receive WMI message response. "
    271272                            "Error: %s\n", str_error_name(rc));
     
    275276                if (response_buffer_size < sizeof(htc_frame_header_t) +
    276277                    sizeof(wmi_command_header_t)) {
    277                         free(buffer);
    278278                        usb_log_error("Corrupted response received.\n");
    279279                        return EINVAL;
Note: See TracChangeset for help on using the changeset viewer.