aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-sensor-hub.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-sensor-hub.c')
-rw-r--r--drivers/hid/hid-sensor-hub.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index c3f6f1e311ea..090a1ba0abb6 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -294,7 +294,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
294 if (!report) 294 if (!report)
295 return -EINVAL; 295 return -EINVAL;
296 296
297 mutex_lock(&hsdev->mutex); 297 mutex_lock(hsdev->mutex_ptr);
298 if (flag == SENSOR_HUB_SYNC) { 298 if (flag == SENSOR_HUB_SYNC) {
299 memset(&hsdev->pending, 0, sizeof(hsdev->pending)); 299 memset(&hsdev->pending, 0, sizeof(hsdev->pending));
300 init_completion(&hsdev->pending.ready); 300 init_completion(&hsdev->pending.ready);
@@ -328,7 +328,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
328 kfree(hsdev->pending.raw_data); 328 kfree(hsdev->pending.raw_data);
329 hsdev->pending.status = false; 329 hsdev->pending.status = false;
330 } 330 }
331 mutex_unlock(&hsdev->mutex); 331 mutex_unlock(hsdev->mutex_ptr);
332 332
333 return ret_val; 333 return ret_val;
334} 334}
@@ -667,7 +667,14 @@ static int sensor_hub_probe(struct hid_device *hdev,
667 hsdev->vendor_id = hdev->vendor; 667 hsdev->vendor_id = hdev->vendor;
668 hsdev->product_id = hdev->product; 668 hsdev->product_id = hdev->product;
669 hsdev->usage = collection->usage; 669 hsdev->usage = collection->usage;
670 mutex_init(&hsdev->mutex); 670 hsdev->mutex_ptr = devm_kzalloc(&hdev->dev,
671 sizeof(struct mutex),
672 GFP_KERNEL);
673 if (!hsdev->mutex_ptr) {
674 ret = -ENOMEM;
675 goto err_stop_hw;
676 }
677 mutex_init(hsdev->mutex_ptr);
671 hsdev->start_collection_index = i; 678 hsdev->start_collection_index = i;
672 if (last_hsdev) 679 if (last_hsdev)
673 last_hsdev->end_collection_index = i; 680 last_hsdev->end_collection_index = i;