mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* led-gpio: do we really need xstrdup
@ 2014-07-26  0:11 Antony Pavlov
  0 siblings, 0 replies; only message in thread
From: Antony Pavlov @ 2014-07-26  0:11 UTC (permalink / raw)
  To: Sebastian Hesselbarth; +Cc: barebox

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

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-07-25 23:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-26  0:11 led-gpio: do we really need xstrdup Antony Pavlov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox