aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-device-cdev.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-03-07 12:12:44 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-09 16:03:09 -0500
commita3aca3dabbcf00f2088d472f27755c29acaa992e (patch)
treec6b23c1d51a7eab5bee4137d344264974ddfc432 /drivers/firewire/fw-device-cdev.c
parent344bbc4de14e70d03f09bff04bb7d161b8a0d28c (diff)
firewire: Switch cdev code over to use register_chrdev and keep a list of devices.
The old mechanism kept a struct cdev for each fw device, but fops->release would reference this struct after the device got freed in some cases. Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-device-cdev.c')
-rw-r--r--drivers/firewire/fw-device-cdev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/firewire/fw-device-cdev.c b/drivers/firewire/fw-device-cdev.c
index d9f3bb2be1c2..54ef27b2adb5 100644
--- a/drivers/firewire/fw-device-cdev.c
+++ b/drivers/firewire/fw-device-cdev.c
@@ -28,6 +28,7 @@
28#include <linux/poll.h> 28#include <linux/poll.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/mm.h> 30#include <linux/mm.h>
31#include <linux/idr.h>
31#include <linux/compat.h> 32#include <linux/compat.h>
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include "fw-transaction.h" 34#include "fw-transaction.h"
@@ -103,7 +104,9 @@ static int fw_device_op_open(struct inode *inode, struct file *file)
103 struct client *client; 104 struct client *client;
104 unsigned long flags; 105 unsigned long flags;
105 106
106 device = container_of(inode->i_cdev, struct fw_device, cdev); 107 device = fw_device_from_devt(inode->i_rdev);
108 if (device == NULL)
109 return -ENODEV;
107 110
108 client = kzalloc(sizeof *client, GFP_KERNEL); 111 client = kzalloc(sizeof *client, GFP_KERNEL);
109 if (client == NULL) 112 if (client == NULL)