/* Wait until the usb device reports it received all
                 * the bytes we sent */
                if ((rdlbytes == sent) && (rdlbytes != dllen)) {
-                       if ((dllen-sent) < TRX_RDL_CHUNK)
-                               sendlen = dllen-sent;
-                       else
-                               sendlen = TRX_RDL_CHUNK;
+                       sendlen = min(dllen - sent, TRX_RDL_CHUNK);
 
                        /* simply avoid having to send a ZLP by ensuring we
                         * never have an even
 
 
                if (mphase) {
                        cal_cnt = pi->mphase_txcal_cmdidx;
-                       if ((cal_cnt + pi->mphase_txcal_numcmds) < max_cal_cmds)
-                               num_cals = cal_cnt + pi->mphase_txcal_numcmds;
-                       else
-                               num_cals = max_cal_cmds;
+                       num_cals = min(cal_cnt + pi->mphase_txcal_numcmds,
+                                      max_cal_cmds);
                } else {
                        cal_cnt = 0;
                        num_cals = max_cal_cmds;