[PATCH 2/9] staging: comedi: remove unneeded chanlist pointer casts

Ian Abbott abbotti at mev.co.uk
Wed Sep 19 18:37:36 UTC 2012


The `chanlist` pointer in `struct comedi_cmd` is tagged with `__user`
again, so we can get rid of some casts in `do_cmd_ioctl()` and
`do_cmdtest_ioctl()`.

Signed-off-by: Ian Abbott <abbotti at mev.co.uk>
---
 drivers/staging/comedi/comedi_fops.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index f496f4d..67c7bdc 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1145,7 +1145,7 @@ static int do_cmd_ioctl(struct comedi_device *dev,
 		return -EFAULT;
 	}
 	/* save user's chanlist pointer so it can be restored later */
-	user_chanlist = (unsigned int __user *)cmd.chanlist;
+	user_chanlist = cmd.chanlist;
 
 	if (cmd.subdev >= dev->n_subdevices) {
 		DPRINTK("%d no such subdevice\n", cmd.subdev);
@@ -1229,7 +1229,7 @@ static int do_cmd_ioctl(struct comedi_device *dev,
 		DPRINTK("test returned %d\n", ret);
 		cmd = async->cmd;
 		/* restore chanlist pointer before copying back */
-		cmd.chanlist = (unsigned int __force *)user_chanlist;
+		cmd.chanlist = user_chanlist;
 		cmd.data = NULL;
 		if (copy_to_user(arg, &cmd, sizeof(struct comedi_cmd))) {
 			DPRINTK("fault writing cmd\n");
@@ -1295,7 +1295,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,
 		return -EFAULT;
 	}
 	/* save user's chanlist pointer so it can be restored later */
-	user_chanlist = (unsigned int __user *)cmd.chanlist;
+	user_chanlist = cmd.chanlist;
 
 	if (cmd.subdev >= dev->n_subdevices) {
 		DPRINTK("%d no such subdevice\n", cmd.subdev);
@@ -1352,7 +1352,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,
 	ret = s->do_cmdtest(dev, s, &cmd);
 
 	/* restore chanlist pointer before copying back */
-	cmd.chanlist = (unsigned int __force *)user_chanlist;
+	cmd.chanlist = user_chanlist;
 
 	if (copy_to_user(arg, &cmd, sizeof(struct comedi_cmd))) {
 		DPRINTK("bad cmd address\n");
-- 
1.7.12




More information about the devel mailing list