input-leds.c (754451342fc5954061ede74b0a8485ec4a4c6eaa) | input-leds.c (acafe7e30216166a17e6e226aadc3ecb63993242) |
---|---|
1/* 2 * LED support for the input layer 3 * 4 * Copyright 2010-2015 Samuel Thibault <samuel.thibault@ens-lyon.org> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation. --- 84 unchanged lines hidden (view full) --- 93 unsigned int led_code; 94 int led_no; 95 int error; 96 97 num_leds = input_leds_get_count(dev); 98 if (!num_leds) 99 return -ENXIO; 100 | 1/* 2 * LED support for the input layer 3 * 4 * Copyright 2010-2015 Samuel Thibault <samuel.thibault@ens-lyon.org> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation. --- 84 unchanged lines hidden (view full) --- 93 unsigned int led_code; 94 int led_no; 95 int error; 96 97 num_leds = input_leds_get_count(dev); 98 if (!num_leds) 99 return -ENXIO; 100 |
101 leds = kzalloc(sizeof(*leds) + num_leds * sizeof(*leds->leds), 102 GFP_KERNEL); | 101 leds = kzalloc(struct_size(leds, leds, num_leds), GFP_KERNEL); |
103 if (!leds) 104 return -ENOMEM; 105 106 leds->num_leds = num_leds; 107 108 leds->handle.dev = dev; 109 leds->handle.handler = handler; 110 leds->handle.name = "leds"; --- 114 unchanged lines hidden --- | 102 if (!leds) 103 return -ENOMEM; 104 105 leds->num_leds = num_leds; 106 107 leds->handle.dev = dev; 108 leds->handle.handler = handler; 109 leds->handle.name = "leds"; --- 114 unchanged lines hidden --- |