led-gpio: do we really need xstrdup
Antony Pavlov
antonynpavlov at gmail.com
Fri Jul 25 17:11:16 PDT 2014
Hi all!
Do we really need xstrdup for led's name?
Please see drivers/led/led-gpio.c: led_gpio_of_probe()
for_each_child_of_node(dev->device_node, child) {
struct gpio_led *gled;
enum of_gpio_flags flags;
int gpio;
gpio = of_get_named_gpio_flags(child, "gpios", 0, &flags);
if (gpio < 0)
continue;
gled = xzalloc(sizeof(*gled));
gled->led.name = xstrdup(child->name);
^^^^^^^^^^^^^^^^^^^^^^^^^ ??????????????
gled->gpio = gpio;
gled->active_low = (flags & OF_GPIO_ACTIVE_LOW) ? 1 : 0;
dev_dbg(dev, "register led %s on gpio%d, active_low = %d\n",
gled->led.name, gled->gpio, gled->active_low);
led_gpio_register(gled);
led_of_parse_trigger(&gled->led, child);
}
--
Best regards,
Antony Pavlov
More information about the barebox
mailing list