Changeset 6f05705 in mainline


Ignore:
Timestamp:
2011-10-07T17:12:30Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fec6bf2
Parents:
75f9dcd
Message:

usbhub: Declare iteration variables inside for loops.

Codestyle.

Location:
uspace/drv/bus/usb/usbhub
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/port.c

    r75f9dcd r6f05705  
    469469        assert(port);
    470470        struct add_device_phase1 *data
    471             = malloc(sizeof (struct add_device_phase1));
     471            = malloc(sizeof(struct add_device_phase1));
    472472        if (data == NULL) {
    473473                return ENOMEM;
  • uspace/drv/bus/usb/usbhub/usbhub.c

    r75f9dcd r6f05705  
    212212        info->ports = NULL;
    213213        info->port_count = -1;
     214        info->pending_ops_count = 0;
    214215        fibril_mutex_initialize(&info->pending_ops_mutex);
    215216        fibril_condvar_initialize(&info->pending_ops_cv);
    216         info->pending_ops_count = 0;
    217217
    218218        return info;
     
    254254        // TODO: +1 hack is no longer necessary
    255255        hub_info->ports =
    256             malloc(sizeof(usb_hub_port_t) * (hub_info->port_count + 1));
     256            calloc(hub_info->port_count + 1, sizeof(usb_hub_port_t));
    257257        if (!hub_info->ports) {
    258258                return ENOMEM;
    259259        }
    260260
    261         size_t port;
    262         for (port = 0; port < hub_info->port_count + 1; ++port) {
     261        for (size_t port = 1; port < hub_info->port_count + 1; ++port) {
    263262                usb_hub_port_init(&hub_info->ports[port], port, control_pipe);
    264263        }
     
    271270                    & HUB_CHAR_POWER_PER_PORT_FLAG;
    272271
    273                 for (port = 1; port <= hub_info->port_count; ++port) {
     272                for (size_t port = 1; port <= hub_info->port_count; ++port) {
    274273                        usb_log_debug("Powering port %zu.\n", port);
    275274                        opResult = usb_hub_port_set_feature(
Note: See TracChangeset for help on using the changeset viewer.