@@ -173,14 +173,17 @@ int sensor_hub_register_callback(struct hid_sensor_hub_device *hsdev,
spin_unlock(&pdata->dyn_callback_lock);
return -EINVAL;
}
+ spin_unlock(&pdata->dyn_callback_lock);
+
callback = kzalloc(sizeof(*callback), GFP_KERNEL);
- if (!callback) {
- spin_unlock(&pdata->dyn_callback_lock);
+ if (!callback)
return -ENOMEM;
- }
+
callback->usage_callback = usage_callback;
callback->usage_id = usage_id;
callback->priv = NULL;
+
+ spin_lock(&pdata->dyn_callback_lock);
list_add_tail(&callback->list, &pdata->dyn_callback_list);
spin_unlock(&pdata->dyn_callback_lock);