Without any uld being loaded, uld_txq_info[] will be NULL. uld_send()
is also used for sending control work requests(for eg: setting filter)
that dont require any ulds to be loaded. Hence move uld_txq_info[]
assignment after ctrl_xmit().
Also added a NULL check for uld_txq_info[].
Fixes: 94cdb8bb993a (cxgb4: Add support for dynamic allocation
       of resources for ULD).
Signed-off-by: Arjun V <arjun@chelsio.com>
Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
        struct sge_uld_txq *txq;
        unsigned int idx = skb_txq(skb);
 
-       txq_info = adap->sge.uld_txq_info[tx_uld_type];
-       txq = &txq_info->uldtxq[idx];
-
        if (unlikely(is_ctrl_pkt(skb))) {
                /* Single ctrl queue is a requirement for LE workaround path */
                if (adap->tids.nsftids)
                        idx = 0;
                return ctrl_xmit(&adap->sge.ctrlq[idx], skb);
        }
+
+       txq_info = adap->sge.uld_txq_info[tx_uld_type];
+       if (unlikely(!txq_info)) {
+               WARN_ON(true);
+               return NET_XMIT_DROP;
+       }
+
+       txq = &txq_info->uldtxq[idx];
        return ofld_xmit(txq, skb);
 }