led-gpio: do we really need xstrdup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux