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>
#include <linux/poll.h>
#include <linux/delay.h>
#include <linux/mm.h>
+#include <linux/idr.h>
#include <linux/compat.h>
#include <asm/uaccess.h>
#include "fw-transaction.h"
struct client *client;
unsigned long flags;
- device = container_of(inode->i_cdev, struct fw_device, cdev);
+ device = fw_device_from_devt(inode->i_rdev);
+ if (device == NULL)
+ return -ENODEV;
client = kzalloc(sizeof *client, GFP_KERNEL);
if (client == NULL)