cezanne / usbip-win

USB/IP for Windows
GNU General Public License v3.0
1.97k stars 350 forks source link

update_driver function in userspace-lib-usbip_stub.c #314

Open Kogotoro opened 2 years ago

Kogotoro commented 2 years ago

block if (n_tries >= 5) {...} probably should be first in while-loop-scope (edit: with change ret from ERR_BADBIND to ERR_NOTBIND in that case?) , otherwise we perform aply-block 6 times and rollbak-block 5 times...?

static int 
update_driver(HDEVINFO dev_info, PSP_DEVINFO_DATA pdev_info_data)
{
...
while (TRUE) {
ret = apply_driver(inst_id, TRUE, &need_reboot);
if (ret == 0 && !need_reboot)
    break;
if (n_tries >= 5) { 
...
    break;
}
n_tries++;
if (apply_driver(inst_id, FALSE, NULL) != 0) {
...
    break;
}
}
...
}