input-mt.c (712cba5d87a6c0e980ee5fad45734e189c4d7151) | input-mt.c (acafe7e30216166a17e6e226aadc3ecb63993242) |
---|---|
1/* 2 * Input Multitouch Library 3 * 4 * Copyright (c) 2008-2010 Henrik Rydberg 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 as published by 8 * the Free Software Foundation. --- 35 unchanged lines hidden (view full) --- 44 struct input_mt *mt = dev->mt; 45 int i; 46 47 if (!num_slots) 48 return 0; 49 if (mt) 50 return mt->num_slots != num_slots ? -EINVAL : 0; 51 | 1/* 2 * Input Multitouch Library 3 * 4 * Copyright (c) 2008-2010 Henrik Rydberg 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 as published by 8 * the Free Software Foundation. --- 35 unchanged lines hidden (view full) --- 44 struct input_mt *mt = dev->mt; 45 int i; 46 47 if (!num_slots) 48 return 0; 49 if (mt) 50 return mt->num_slots != num_slots ? -EINVAL : 0; 51 |
52 mt = kzalloc(sizeof(*mt) + num_slots * sizeof(*mt->slots), GFP_KERNEL); | 52 mt = kzalloc(struct_size(mt, slots, num_slots), GFP_KERNEL); |
53 if (!mt) 54 goto err_mem; 55 56 mt->num_slots = num_slots; 57 mt->flags = flags; 58 input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0); 59 input_set_abs_params(dev, ABS_MT_TRACKING_ID, 0, TRKID_MAX, 0, 0); 60 --- 431 unchanged lines hidden --- | 53 if (!mt) 54 goto err_mem; 55 56 mt->num_slots = num_slots; 57 mt->flags = flags; 58 input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0); 59 input_set_abs_params(dev, ABS_MT_TRACKING_ID, 0, TRKID_MAX, 0, 0); 60 --- 431 unchanged lines hidden --- |