lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Mon, 21 May 2012 17:52:39 +0200
From:	Johan Hovold <jhovold@...il.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Richard Purdie <rpurdie@...ys.net>, linux-kernel@...r.kernel.org,
	Johan Hovold <jhovold@...il.com>
Subject: [PATCH] leds: lm3533: use devres to manage driver data

Use devres to manage driver data.

Signed-off-by: Johan Hovold <jhovold@...il.com>
---
 drivers/leds/leds-lm3533.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/leds/leds-lm3533.c b/drivers/leds/leds-lm3533.c
index 4ef496c..e968470 100644
--- a/drivers/leds/leds-lm3533.c
+++ b/drivers/leds/leds-lm3533.c
@@ -632,7 +632,7 @@ static int __devinit lm3533_led_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	led = kzalloc(sizeof(*led), GFP_KERNEL);
+	led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL);
 	if (!led)
 		return -ENOMEM;
 
@@ -661,7 +661,7 @@ static int __devinit lm3533_led_probe(struct platform_device *pdev)
 	ret = led_classdev_register(pdev->dev.parent, &led->cdev);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register LED %d\n", pdev->id);
-		goto err_free;
+		return ret;
 	}
 
 	led->cb.dev = led->cdev.dev;
@@ -688,8 +688,6 @@ err_sysfs_remove:
 err_unregister:
 	led_classdev_unregister(&led->cdev);
 	flush_work_sync(&led->work);
-err_free:
-	kfree(led);
 
 	return ret;
 }
@@ -704,7 +702,6 @@ static int __devexit lm3533_led_remove(struct platform_device *pdev)
 	sysfs_remove_group(&led->cdev.dev->kobj, &lm3533_led_attribute_group);
 	led_classdev_unregister(&led->cdev);
 	flush_work_sync(&led->work);
-	kfree(led);
 
 	return 0;
 }
-- 
1.7.8.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ