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:	Sat, 25 Aug 2012 19:41:35 +0200
From:	Julia Lawall <Julia.Lawall@...6.fr>
To:	"Jean Delvare (PC drivers core)" <khali@...ux-fr.org>
Cc:	kernel-janitors@...r.kernel.org,
	"Ben Dooks (embedded platforms)" <ben-linux@...ff.org>,
	"Wolfram Sang (embedded platforms)" <w.sang@...gutronix.de>,
	linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 5/6] i2c: ibm_iic: use devm_ functions

From: Julia Lawall <Julia.Lawall@...6.fr>

The various devm_ functions allocate memory that is released when a driver
detaches.  This patch uses these functions for data that is allocated in
the probe function of a platform device and is only freed in the remove
function.

Signed-off-by: Julia Lawall <Julia.Lawall@...6.fr>

---
Not compiled.

 drivers/i2c/busses/i2c-ibm_iic.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 806e225..76435c2 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -699,7 +699,7 @@ static int __devinit iic_probe(struct platform_device *ofdev)
 	const u32 *freq;
 	int ret;
 
-	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+	dev = devm_kzalloc(&ofdev->dev, sizeof(*dev), GFP_KERNEL);
 	if (!dev) {
 		dev_err(&ofdev->dev, "failed to allocate device data\n");
 		return -ENOMEM;
@@ -774,7 +774,6 @@ error_cleanup:
 		iounmap(dev->vaddr);
 
 	dev_set_drvdata(&ofdev->dev, NULL);
-	kfree(dev);
 	return ret;
 }
 
@@ -795,7 +794,6 @@ static int __devexit iic_remove(struct platform_device *ofdev)
 	}
 
 	iounmap(dev->vaddr);
-	kfree(dev);
 
 	return 0;
 }

--
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