Hi Evan, Simon, Please merge these changes with the patch v3 [1] - I've been waiting for this update and hasn't applied v3 yet. [1] http://www.spinics.net/lists/linux-leds/msg05353.html On 02/21/2016 08:07 PM, Evan McClain wrote:
Also use managed devm_kzalloc. Signed-off-by: Evan McClain <aeroevan@xxxxxxxxx> --- drivers/leds/leds-chromeos-keyboard.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/leds/leds-chromeos-keyboard.c b/drivers/leds/leds-chromeos-keyboard.c index 6a6ff75..4e56ede 100644 --- a/drivers/leds/leds-chromeos-keyboard.c +++ b/drivers/leds/leds-chromeos-keyboard.c @@ -69,7 +69,7 @@ static int keyboard_led_probe(struct platform_device *pdev) return -ENODEV; } - cdev = kzalloc(sizeof(struct led_classdev), GFP_KERNEL); + cdev = devm_kzalloc(&pdev->dev, sizeof(struct led_classdev), GFP_KERNEL); if (!cdev) return -ENOMEM; cdev->name = "chromeos::kbd_backlight"; @@ -78,15 +78,12 @@ static int keyboard_led_probe(struct platform_device *pdev) cdev->brightness = cdev->max_brightness; cdev->flags |= LED_CORE_SUSPENDRESUME; - ret = led_classdev_register(&pdev->dev, cdev); + ret = devm_led_classdev_register(&pdev->dev, cdev); if (ret) - goto err; + return ret; platform_set_drvdata(pdev, cdev); return 0; -err: - kfree(cdev); - return ret; } static int keyboard_led_remove(struct platform_device *pdev) @@ -94,7 +91,6 @@ static int keyboard_led_remove(struct platform_device *pdev) struct led_classdev *cdev = platform_get_drvdata(pdev); platform_set_drvdata(pdev, NULL); - kfree(cdev); return 0; }
-- Best regards, Jacek Anaszewski -- To unsubscribe from this list: send the line "unsubscribe linux-leds" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html