Prev: [042/156] ALSA: hda: Fix 0 dB offset for HP laptops using CX20551 (Waikiki)
Next: [027/156] KVM: x86: Add KVM_CAP_X86_ROBUST_SINGLESTEP
From: Greg KH on 30 Mar 2010 20:00 2.6.32-stable review patch. If anyone has any objections, please let us know. ------------------ From: Anton Vorontsov <avorontsov(a)ru.mvista.com> commit 0493a4ff10959ff4c8e0d65efee25b7ffd4fa5db upstream. The driver wrongly sets default state for LEDs that don't specify default-state property. Currently the driver handles default state this way: memset(&led, 0, sizeof(led)); for_each_child_of_node(np, child) { state = of_get_property(child, "default-state", NULL); if (state) { if (!strcmp(state, "keep")) led.default_state = LEDS_GPIO_DEFSTATE_KEEP; ... } ret = create_gpio_led(&led, ...); } Which means that all LEDs that do not specify default-state will inherit the last value of the default-state property, which is wrong. This patch fixes the issue by moving LED's template initialization into the loop body. Signed-off-by: Anton Vorontsov <avorontsov(a)ru.mvista.com> Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org> Signed-off-by: Richard Purdie <rpurdie(a)linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh(a)suse.de> --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -211,7 +211,6 @@ static int __devinit of_gpio_leds_probe(struct of_device *ofdev, const struct of_device_id *match) { struct device_node *np = ofdev->node, *child; - struct gpio_led led; struct gpio_led_of_platform_data *pdata; int count = 0, ret; @@ -226,8 +225,8 @@ static int __devinit of_gpio_leds_probe(struct of_device *ofdev, if (!pdata) return -ENOMEM; - memset(&led, 0, sizeof(led)); for_each_child_of_node(np, child) { + struct gpio_led led = {}; enum of_gpio_flags flags; const char *state; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |