From 61d57e176cb88da42961c28c7ee661af419d7a7c Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 21 Aug 2007 09:47:21 +0000 Subject: [PATCH] Sanity check drivers setting do_cmd without setting do_cmdtest. --- comedi/comedi_fops.c | 4 ++-- comedi/drivers.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index 819d99f4..1b5c9bdb 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -889,7 +889,7 @@ static int do_cmd_ioctl(comedi_device *dev,void *arg,void *file) return -EIO; } - if(!s->do_cmd || !s->async){ + if(!s->do_cmd || !s->do_cmdtest || !s->async){ DPRINTK("subdevice %i does not support commands\n", user_cmd.subdev); return -EIO; } @@ -1027,7 +1027,7 @@ static int do_cmdtest_ioctl(comedi_device *dev,void *arg,void *file) return -EIO; } - if(!s->do_cmd){ + if(!s->do_cmd || !s->do_cmdtest){ DPRINTK("subdevice %i does not support commands\n", user_cmd.subdev); return -EIO; } diff --git a/comedi/drivers.c b/comedi/drivers.c index be47412d..059ff2a0 100644 --- a/comedi/drivers.c +++ b/comedi/drivers.c @@ -266,6 +266,7 @@ static int postconfig(comedi_device *dev) dev_t devt; BUG_ON((s->subdev_flags & (SDF_CMD_READ | SDF_CMD_WRITE)) == 0); + BUG_ON(!s->do_cmdtest); async = kmalloc(sizeof(comedi_async), GFP_KERNEL); if(async == NULL) -- 2.26.2