hi On 2015년 02월 27일 12:36, Varka Bhadram wrote: > On 02/27/2015 06:31 AM, Ingi Kim wrote: >> This patch adds a driver to support the ktd2692 flash LEDs. >> ktd2692 can control flash current by ExpressWire interface. >> >> Signed-off-by: Ingi Kim <ingi2.kim@xxxxxxxxxxx> >> --- >> drivers/leds/Kconfig | 8 ++ >> drivers/leds/Makefile | 1 + >> drivers/leds/leds-ktd2692.c | 245 +++++++++++++++++++++++++++++++++++++++++++ >> 3 files changed, 254 insertions(+) >> create mode 100644 drivers/leds/leds-ktd2692.c >> > (...) > >> +static struct ktd2692_context *ktd2692_parse_dt(struct device *dev) >> +{ >> + struct device_node *np = dev->of_node; >> + struct ktd2692_context *led; >> + >> + led = devm_kzalloc(dev, sizeof(struct ktd2692_context), GFP_KERNEL); >> + if (!led) >> + return ERR_PTR((long)led); > > What about using sizeof(*led) in place of sizeof(struct ktd2692_context)..? > > Also the error return for devm_kzalloc() should be -ENOMEM. > Thanks, I'll check and change sizeof() and error return style. >> + >> + led->strobe_gpio = of_get_named_gpio(np, "strobe-gpio", 0); >> + if (!gpio_is_valid(led->strobe_gpio)) { >> + dev_err(dev, "no strobe_gpio property found\n"); >> + return ERR_PTR(led->strobe_gpio); >> + } >> + >> + return led; >> +} >> + >> +static int ktd2692_probe(struct platform_device *pdev) >> +{ >> + struct device *dev = &pdev->dev; >> + struct ktd2692_context *led; >> + int ret; >> + >> + if (!dev->of_node) >> + return -ENODEV; >> + >> + led = ktd2692_parse_dt(dev); >> + if (IS_ERR(led)) >> + return PTR_ERR(led); >> + >> + led->cdev.name = KTD2692_DEFAULT_NAME; >> + led->cdev.brightness = LED_OFF; >> + led->cdev.max_brightness = LED_FULL; >> + led->cdev.flags |= LED_CORE_SUSPENDRESUME; >> + led->cdev.brightness_set = ktd2692_brightness_set; >> + led->cdev.brightness_get = ktd2692_brightness_get; >> + led->mode = KTD2692_REG_MODE_BASE | KTD2692_MODE_DISABLE; >> + >> + platform_set_drvdata(pdev, led); >> + >> + ret = led_classdev_register(&pdev->dev, &led->cdev); >> + if (ret) { >> + dev_err(dev, "couldn't register LED %s\n", led->cdev.name); >> + return ret; >> + } >> + >> + ret = ktd2692_brightness_set_gpio(led); >> + if (ret) { >> + led_classdev_unregister(&led->cdev); >> + return ret; >> + } >> + >> + ktd2692_expresswire_reset(led); >> + >> + return ret; > > return 0 instead of ret...? > > > I'll check and try Thanks, -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html