Bluetooth: Use devm_kzalloc in btuart_cs.c file

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Sep 29 10:59:25 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=fdefa118ebbcadad4adbaaab067be06a96a48e15
Commit:     fdefa118ebbcadad4adbaaab067be06a96a48e15
Parent:     3a382772b51bbf55b23701746102bd75b9fe883f
Author:     Sachin Kamat <sachin.kamat at linaro.org>
AuthorDate: Fri Jul 27 12:38:38 2012 +0530
Committer:  Gustavo Padovan <gustavo.padovan at collabora.co.uk>
CommitDate: Mon Aug 6 15:03:02 2012 -0300

    Bluetooth: Use devm_kzalloc in btuart_cs.c file
    
    devm_kzalloc() eliminates the need to free memory explicitly
    thereby saving some cleanup code.
    
    Signed-off-by: Sachin Kamat <sachin.kamat at linaro.org>
    Acked-by: Marcel Holtmann <marcel at holtmann.org>
    Signed-off-by: Gustavo Padovan <gustavo.padovan at collabora.co.uk>
---
 drivers/bluetooth/btuart_cs.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index 21e803a..2f510a8 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -567,7 +567,7 @@ static int btuart_probe(struct pcmcia_device *link)
 	btuart_info_t *info;
 
 	/* Create new info device */
-	info = kzalloc(sizeof(*info), GFP_KERNEL);
+	info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
 
@@ -583,10 +583,7 @@ static int btuart_probe(struct pcmcia_device *link)
 
 static void btuart_detach(struct pcmcia_device *link)
 {
-	btuart_info_t *info = link->priv;
-
 	btuart_release(link);
-	kfree(info);
 }
 
 static int btuart_check_config(struct pcmcia_device *p_dev, void *priv_data)



More information about the linux-mtd-cvs mailing list