Patchwork ps3vram: Use proc_create_data() instead of proc_create()

login
register
mail settings
Submitter Geert Uytterhoeven
Date April 3, 2009, 1:05 p.m.
Message ID <1238763938-7076-2-git-send-email-Geert.Uytterhoeven@sonycom.com>
Download mbox | patch
Permalink /patch/25575/
State Accepted, archived
Commit 3c20e2f2793380add92dacce63395a8503b6c7c9
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Geert Uytterhoeven - April 3, 2009, 1:05 p.m.
Use proc_create_data() to avoid race conditions.

Reported-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
---
 drivers/block/ps3vram.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
index 2e79d2c..6e73868 100644
--- a/drivers/block/ps3vram.c
+++ b/drivers/block/ps3vram.c
@@ -546,12 +546,10 @@  static void __devinit ps3vram_proc_init(struct ps3_system_bus_device *dev)
 	struct ps3vram_priv *priv = dev->core.driver_data;
 	struct proc_dir_entry *pde;
 
-	pde = proc_create(DEVICE_NAME, 0444, NULL, &ps3vram_proc_fops);
-	if (!pde) {
+	pde = proc_create_data(DEVICE_NAME, 0444, NULL, &ps3vram_proc_fops,
+			       priv);
+	if (!pde)
 		dev_warn(&dev->core, "failed to create /proc entry\n");
-		return;
-	}
-	pde->data = priv;
 }
 
 static int ps3vram_make_request(struct request_queue *q, struct bio *bio)