comedi_device *dev;
int rc;
- if(dev_file_info == NULL || dev_file_info->device == NULL) return -ENODEV;
+ if (dev_file_info == NULL) return -ENODEV;
dev = dev_file_info->device;
+ if (dev == NULL) return -ENODEV;
mutex_lock(&dev->mutex);
static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
{
const unsigned minor = iminor(file->f_dentry->d_inode);
- struct comedi_device_file_info *dev_file_info = comedi_get_device_file_info(minor);
- comedi_device *dev = dev_file_info->device;
comedi_async *async = NULL;
unsigned long start = vma->vm_start;
unsigned long size;
int i;
int retval;
comedi_subdevice *s;
+ struct comedi_device_file_info *dev_file_info = comedi_get_device_file_info(minor);
+ comedi_device *dev;
+ if (dev_file_info==NULL) return -ENODEV;
+ dev = dev_file_info->device;
+ if (dev==NULL) return -ENODEV;
mutex_lock(&dev->mutex);
if (!dev->attached) {
{
unsigned int mask = 0;
const unsigned minor = iminor(file->f_dentry->d_inode);
- struct comedi_device_file_info *dev_file_info = comedi_get_device_file_info(minor);
- comedi_device *dev = dev_file_info->device;
comedi_subdevice *read_subdev;
comedi_subdevice *write_subdev;
+ struct comedi_device_file_info *dev_file_info = comedi_get_device_file_info(minor);
+ comedi_device *dev;
+ if (dev_file_info==NULL) return -ENODEV;
+ dev = dev_file_info->device;
+ if (dev==NULL) return -ENODEV;
mutex_lock(&dev->mutex);
if (!dev->attached) {
DECLARE_WAITQUEUE(wait, current);
const unsigned minor = iminor(file->f_dentry->d_inode);
struct comedi_device_file_info *dev_file_info = comedi_get_device_file_info(minor);
- comedi_device *dev = dev_file_info->device;
+ comedi_device *dev;
+ if (dev_file_info==NULL) return -ENODEV;
+ dev = dev_file_info->device;
+ if (dev==NULL) return -ENODEV;
if (!dev->attached) {
DPRINTK("no driver configured on comedi%i\n", dev->minor);
DECLARE_WAITQUEUE(wait, current);
const unsigned minor = iminor(file->f_dentry->d_inode);
struct comedi_device_file_info *dev_file_info = comedi_get_device_file_info(minor);
- comedi_device *dev = dev_file_info->device;
+ comedi_device *dev;
+ if (dev_file_info==NULL) return -ENODEV;
+ dev = dev_file_info->device;
+ if (dev==NULL) return -ENODEV;
if (!dev->attached) {
DPRINTK("no driver configured on comedi%i\n", dev->minor);
static int comedi_close(struct inode *inode, struct file *file)
{
const unsigned minor = iminor(inode);
- struct comedi_device_file_info *dev_file_info = comedi_get_device_file_info(minor);
- comedi_device *dev = dev_file_info->device;
comedi_subdevice *s = NULL;
int i;
+ struct comedi_device_file_info *dev_file_info = comedi_get_device_file_info(minor);
+ comedi_device *dev;
+ if (dev_file_info==NULL) return -ENODEV;
+ dev = dev_file_info->device;
+ if (dev==NULL) return -ENODEV;
mutex_lock(&dev->mutex);
{
const unsigned minor = iminor(file->f_dentry->d_inode);
struct comedi_device_file_info *dev_file_info = comedi_get_device_file_info(minor);
- comedi_device *dev = dev_file_info->device;
+ comedi_device *dev;
+ if (dev_file_info==NULL) return -ENODEV;
+ dev = dev_file_info->device;
+ if (dev==NULL) return -ENODEV;
return fasync_helper(fd, file, on, &dev->async_queue);
}