Loading drivers/hid/hid-sensor-hub.c +23 −32 Original line number Diff line number Diff line Loading @@ -103,8 +103,7 @@ static int sensor_hub_get_physical_device_count( list_for_each_entry(report, &report_enum->report_list, list) { field = report->field[0]; if (report->maxfield && field && field->physical) if (report->maxfield && field && field->physical) cnt++; } Loading Loading @@ -395,6 +394,7 @@ static int sensor_hub_reset_resume(struct hid_device *hdev) return 0; } #endif /* * Handle raw report as sent by device */ Loading Loading @@ -422,7 +422,6 @@ static int sensor_hub_raw_event(struct hid_device *hdev, spin_lock_irqsave(&pdata->lock, flags); for (i = 0; i < report->maxfield; ++i) { hid_dbg(hdev, "%d collection_index:%x hid:%x sz:%x\n", i, report->field[i]->usage->collection_index, report->field[i]->usage->hid, Loading @@ -432,11 +431,10 @@ static int sensor_hub_raw_event(struct hid_device *hdev, if (pdata->pending.status && pdata->pending.attr_usage_id == report->field[i]->usage->hid) { hid_dbg(hdev, "data was pending ...\n"); pdata->pending.raw_data = kmalloc(sz, GFP_ATOMIC); if (pdata->pending.raw_data) { memcpy(pdata->pending.raw_data, ptr, sz); pdata->pending.raw_data = kmemdup(ptr, sz, GFP_ATOMIC); if (pdata->pending.raw_data) pdata->pending.raw_size = sz; } else else pdata->pending.raw_size = 0; complete(&pdata->pending.ready); } Loading Loading @@ -479,16 +477,15 @@ static int sensor_hub_probe(struct hid_device *hdev, struct hid_field *field; int dev_cnt; sd = kzalloc(sizeof(struct sensor_hub_data), GFP_KERNEL); sd = devm_kzalloc(&hdev->dev, sizeof(*sd), GFP_KERNEL); if (!sd) { hid_err(hdev, "cannot allocate Sensor data\n"); return -ENOMEM; } sd->hsdev = kzalloc(sizeof(struct hid_sensor_hub_device), GFP_KERNEL); sd->hsdev = devm_kzalloc(&hdev->dev, sizeof(*sd->hsdev), GFP_KERNEL); if (!sd->hsdev) { hid_err(hdev, "cannot allocate hid_sensor_hub_device\n"); ret = -ENOMEM; goto err_free_hub; return -ENOMEM; } hid_set_drvdata(hdev, sd); sd->hsdev->hdev = hdev; Loading @@ -500,14 +497,14 @@ static int sensor_hub_probe(struct hid_device *hdev, ret = hid_parse(hdev); if (ret) { hid_err(hdev, "parse failed\n"); goto err_free; return ret; } INIT_LIST_HEAD(&hdev->inputs); ret = hid_hw_start(hdev, 0); if (ret) { hid_err(hdev, "hw start failed\n"); goto err_free; return ret; } ret = hid_hw_open(hdev); if (ret) { Loading Loading @@ -572,10 +569,6 @@ err_close: hid_hw_close(hdev); err_stop_hw: hid_hw_stop(hdev); err_free: kfree(sd->hsdev); err_free_hub: kfree(sd); return ret; } Loading @@ -599,8 +592,6 @@ static void sensor_hub_remove(struct hid_device *hdev) kfree(data->hid_sensor_hub_client_devs); hid_set_drvdata(hdev, NULL); mutex_destroy(&data->mutex); kfree(data->hsdev); kfree(data); } static const struct hid_device_id sensor_hub_devices[] = { Loading Loading
drivers/hid/hid-sensor-hub.c +23 −32 Original line number Diff line number Diff line Loading @@ -103,8 +103,7 @@ static int sensor_hub_get_physical_device_count( list_for_each_entry(report, &report_enum->report_list, list) { field = report->field[0]; if (report->maxfield && field && field->physical) if (report->maxfield && field && field->physical) cnt++; } Loading Loading @@ -395,6 +394,7 @@ static int sensor_hub_reset_resume(struct hid_device *hdev) return 0; } #endif /* * Handle raw report as sent by device */ Loading Loading @@ -422,7 +422,6 @@ static int sensor_hub_raw_event(struct hid_device *hdev, spin_lock_irqsave(&pdata->lock, flags); for (i = 0; i < report->maxfield; ++i) { hid_dbg(hdev, "%d collection_index:%x hid:%x sz:%x\n", i, report->field[i]->usage->collection_index, report->field[i]->usage->hid, Loading @@ -432,11 +431,10 @@ static int sensor_hub_raw_event(struct hid_device *hdev, if (pdata->pending.status && pdata->pending.attr_usage_id == report->field[i]->usage->hid) { hid_dbg(hdev, "data was pending ...\n"); pdata->pending.raw_data = kmalloc(sz, GFP_ATOMIC); if (pdata->pending.raw_data) { memcpy(pdata->pending.raw_data, ptr, sz); pdata->pending.raw_data = kmemdup(ptr, sz, GFP_ATOMIC); if (pdata->pending.raw_data) pdata->pending.raw_size = sz; } else else pdata->pending.raw_size = 0; complete(&pdata->pending.ready); } Loading Loading @@ -479,16 +477,15 @@ static int sensor_hub_probe(struct hid_device *hdev, struct hid_field *field; int dev_cnt; sd = kzalloc(sizeof(struct sensor_hub_data), GFP_KERNEL); sd = devm_kzalloc(&hdev->dev, sizeof(*sd), GFP_KERNEL); if (!sd) { hid_err(hdev, "cannot allocate Sensor data\n"); return -ENOMEM; } sd->hsdev = kzalloc(sizeof(struct hid_sensor_hub_device), GFP_KERNEL); sd->hsdev = devm_kzalloc(&hdev->dev, sizeof(*sd->hsdev), GFP_KERNEL); if (!sd->hsdev) { hid_err(hdev, "cannot allocate hid_sensor_hub_device\n"); ret = -ENOMEM; goto err_free_hub; return -ENOMEM; } hid_set_drvdata(hdev, sd); sd->hsdev->hdev = hdev; Loading @@ -500,14 +497,14 @@ static int sensor_hub_probe(struct hid_device *hdev, ret = hid_parse(hdev); if (ret) { hid_err(hdev, "parse failed\n"); goto err_free; return ret; } INIT_LIST_HEAD(&hdev->inputs); ret = hid_hw_start(hdev, 0); if (ret) { hid_err(hdev, "hw start failed\n"); goto err_free; return ret; } ret = hid_hw_open(hdev); if (ret) { Loading Loading @@ -572,10 +569,6 @@ err_close: hid_hw_close(hdev); err_stop_hw: hid_hw_stop(hdev); err_free: kfree(sd->hsdev); err_free_hub: kfree(sd); return ret; } Loading @@ -599,8 +592,6 @@ static void sensor_hub_remove(struct hid_device *hdev) kfree(data->hid_sensor_hub_client_devs); hid_set_drvdata(hdev, NULL); mutex_destroy(&data->mutex); kfree(data->hsdev); kfree(data); } static const struct hid_device_id sensor_hub_devices[] = { Loading