9
0
Fork 0

devfs: only check for ioctl function when needed

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2010-06-29 15:56:36 +02:00
parent 8196b9e2cc
commit 9ae9ef472e
1 changed files with 8 additions and 9 deletions

View File

@ -193,6 +193,8 @@ static int partition_ioctl(struct cdev *cdev, int request, void *buf)
user->eccsize = 0;
return 0;
}
if (!cdev->ops->ioctl)
return -EINVAL;
return cdev->ops->ioctl(cdev, request, buf);
default:
return -EINVAL;
@ -202,17 +204,14 @@ static int partition_ioctl(struct cdev *cdev, int request, void *buf)
static int devfs_ioctl(struct device_d *_dev, FILE *f, int request, void *buf)
{
struct cdev *cdev = f->inode;
int ret = -EINVAL;
if (!cdev->ops->ioctl)
goto out;
if (cdev->flags & DEVFS_IS_PARTITION)
ret = partition_ioctl(cdev, request, buf);
else
ret = cdev->ops->ioctl(cdev, request, buf);
out:
return ret;
return partition_ioctl(cdev, request, buf);
if (!cdev->ops->ioctl)
return -EINVAL;
return cdev->ops->ioctl(cdev, request, buf);
}
static int devfs_truncate(struct device_d *dev, FILE *f, ulong size)