mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
HID: core: replace the collection tree pointers with indices
Previously, the pointer to the parent collection was stored. If a device
exceeds 16 collections (HID_DEFAULT_NUM_COLLECTIONS), the array to store
the collections is reallocated, the pointer to the parent collection becomes
invalid.
Replace the pointers with an index-based lookup into the collections array.
Fixes: c53431eb69
("HID: core: store the collections as a basic tree")
Reported-by: Pandruvada, Srinivas <srinivas.pandruvada@intel.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Kyle Pelton <kyle.d.pelton@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
cf26057a94
commit
ee46967fc6
2 changed files with 23 additions and 13 deletions
|
@ -430,7 +430,7 @@ struct hid_local {
|
|||
*/
|
||||
|
||||
struct hid_collection {
|
||||
struct hid_collection *parent;
|
||||
int parent_idx; /* device->collection */
|
||||
unsigned type;
|
||||
unsigned usage;
|
||||
unsigned level;
|
||||
|
@ -658,7 +658,7 @@ struct hid_parser {
|
|||
unsigned int *collection_stack;
|
||||
unsigned int collection_stack_ptr;
|
||||
unsigned int collection_stack_size;
|
||||
struct hid_collection *active_collection;
|
||||
int active_collection_idx; /* device->collection */
|
||||
struct hid_device *device;
|
||||
unsigned int scan_flags;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue