/* calculate the ranges we are going to use */
        first_general = 0;
-       first_sdma = last_general = first_general + 1;
-       first_rx = last_sdma = first_sdma + dd->num_sdma;
+       last_general = first_general + 1;
+       first_sdma = last_general;
+       last_sdma = first_sdma + dd->num_sdma;
+       first_rx = last_sdma;
        last_rx = first_rx + dd->n_krcv_queues;
 
        /*
 
        u32 logical_old = driver_logical_state(ppd);
        int ret, logical_allowed, physical_allowed;
 
-       logical_allowed = ret =
-               logical_transition_allowed(logical_old, logical_new);
+       ret = logical_transition_allowed(logical_old, logical_new);
+       logical_allowed = ret;
 
        if (ret == HFI_TRANSITION_DISALLOWED ||
            ret == HFI_TRANSITION_UNDEFINED) {
                return ret;
        }
 
-       physical_allowed = ret =
-               physical_transition_allowed(physical_old, physical_new);
+       ret = physical_transition_allowed(physical_old, physical_new);
+       physical_allowed = ret;
 
        if (ret == HFI_TRANSITION_DISALLOWED ||
            ret == HFI_TRANSITION_UNDEFINED) {
 
        tx->complete = cb;
        tx->coalesce_buf = NULL;
        tx->wait = NULL;
-       tx->tlen = tx->packet_len = tlen;
+       tx->packet_len = tlen;
+       tx->tlen = tx->packet_len;
        tx->descs[0].qw[0] = SDMA_DESC0_FIRST_DESC_FLAG;
        tx->descs[0].qw[1] = 0;
        if (flags & SDMA_TXREQ_F_AHG_COPY)