usb_modeswitch: apply changes suggested by korli

Didn't notice them in the ticket comments.
This commit is contained in:
Adrien Destugues 2017-01-15 12:53:48 +01:00
parent 7118f1582e
commit 86e8c37605

View File

@ -531,14 +531,13 @@ my_device_added(usb_device newDevice, void **cookie)
mutex_init(&device->lock, DRIVER_NAME " device lock"); mutex_init(&device->lock, DRIVER_NAME " device lock");
sem_id id = create_sem(0, DRIVER_NAME " callback notify"); sem_id callbackSem = create_sem(0, DRIVER_NAME " callback notify");
if (id < B_OK) { if (callbackSem < B_OK) {
mutex_destroy(&device->lock); mutex_destroy(&device->lock);
free(device); free(device);
return id; return callbackSem;
} else {
device->notify = id;
} }
device->notify = callbackSem;
mutex_lock(&gDeviceListLock); mutex_lock(&gDeviceListLock);
device->link = gDeviceList; device->link = gDeviceList;