From 86e8c376053a092a7d5a7100e264cb3c1f7d1eec Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 15 Jan 2017 12:53:48 +0100 Subject: [PATCH] usb_modeswitch: apply changes suggested by korli Didn't notice them in the ticket comments. --- src/add-ons/kernel/drivers/common/usb_modeswitch.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/add-ons/kernel/drivers/common/usb_modeswitch.cpp b/src/add-ons/kernel/drivers/common/usb_modeswitch.cpp index 8638076818..5c3979c85f 100644 --- a/src/add-ons/kernel/drivers/common/usb_modeswitch.cpp +++ b/src/add-ons/kernel/drivers/common/usb_modeswitch.cpp @@ -531,14 +531,13 @@ my_device_added(usb_device newDevice, void **cookie) mutex_init(&device->lock, DRIVER_NAME " device lock"); - sem_id id = create_sem(0, DRIVER_NAME " callback notify"); - if (id < B_OK) { + sem_id callbackSem = create_sem(0, DRIVER_NAME " callback notify"); + if (callbackSem < B_OK) { mutex_destroy(&device->lock); free(device); - return id; - } else { - device->notify = id; + return callbackSem; } + device->notify = callbackSem; mutex_lock(&gDeviceListLock); device->link = gDeviceList;