Commit 32c1957c authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: drivers/video/sis annotation

parent bd6f903c
...@@ -2057,17 +2057,18 @@ sisfb_ioctl(struct inode *inode, struct file *file, ...@@ -2057,17 +2057,18 @@ sisfb_ioctl(struct inode *inode, struct file *file,
sisfb_info x; sisfb_info x;
u32 gpu32 = 0; u32 gpu32 = 0;
static int count = 0; static int count = 0;
u32 __user *argp = (u32 __user *) arg;
switch (cmd) { switch (cmd) {
case FBIO_ALLOC: case FBIO_ALLOC:
if(!capable(CAP_SYS_RAWIO)) { if(!capable(CAP_SYS_RAWIO)) {
return -EPERM; return -EPERM;
} }
if(copy_from_user(&sismemreq, (void *)arg, sizeof(sismemreq))) { if(copy_from_user(&sismemreq, argp, sizeof(sismemreq))) {
return -EFAULT; return -EFAULT;
} }
sis_malloc(&sismemreq); sis_malloc(&sismemreq);
if(copy_to_user((void *)arg, &sismemreq, sizeof(sismemreq))) { if(copy_to_user(argp, &sismemreq, sizeof(sismemreq))) {
sis_free((u32)sismemreq.offset); sis_free((u32)sismemreq.offset);
return -EFAULT; return -EFAULT;
} }
...@@ -2077,7 +2078,7 @@ sisfb_ioctl(struct inode *inode, struct file *file, ...@@ -2077,7 +2078,7 @@ sisfb_ioctl(struct inode *inode, struct file *file,
if(!capable(CAP_SYS_RAWIO)) { if(!capable(CAP_SYS_RAWIO)) {
return -EPERM; return -EPERM;
} }
if(get_user(gpu32, (u32 *)arg)) { if(get_user(gpu32, argp)) {
return -EFAULT; return -EFAULT;
} }
sis_free(gpu32); sis_free(gpu32);
...@@ -2086,13 +2087,13 @@ sisfb_ioctl(struct inode *inode, struct file *file, ...@@ -2086,13 +2087,13 @@ sisfb_ioctl(struct inode *inode, struct file *file,
case FBIOGET_VBLANK: case FBIOGET_VBLANK:
sisvbblank.count = 0; sisvbblank.count = 0;
sisvbblank.flags = sisfb_setupvbblankflags(ivideo, &sisvbblank.vcount, &sisvbblank.hcount); sisvbblank.flags = sisfb_setupvbblankflags(ivideo, &sisvbblank.vcount, &sisvbblank.hcount);
if(copy_to_user((void *)arg, &sisvbblank, sizeof(sisvbblank))) { if(copy_to_user(argp, &sisvbblank, sizeof(sisvbblank))) {
return -EFAULT; return -EFAULT;
} }
break; break;
case SISFB_GET_INFO_SIZE: case SISFB_GET_INFO_SIZE:
return put_user(sizeof(sisfb_info), (u32 *)arg); return put_user(sizeof(sisfb_info), argp);
case SISFB_GET_INFO_OLD: case SISFB_GET_INFO_OLD:
if(++count < 50) { if(++count < 50) {
...@@ -2132,7 +2133,7 @@ sisfb_ioctl(struct inode *inode, struct file *file, ...@@ -2132,7 +2133,7 @@ sisfb_ioctl(struct inode *inode, struct file *file,
x.sisfb_tvxpos = (u16)(ivideo->tvxpos + 32); x.sisfb_tvxpos = (u16)(ivideo->tvxpos + 32);
x.sisfb_tvypos = (u16)(ivideo->tvypos + 32); x.sisfb_tvypos = (u16)(ivideo->tvypos + 32);
if(copy_to_user((void *)arg, &x, sizeof(x))) { if(copy_to_user(argp, &x, sizeof(x))) {
return -EFAULT; return -EFAULT;
} }
break; break;
...@@ -2143,9 +2144,9 @@ sisfb_ioctl(struct inode *inode, struct file *file, ...@@ -2143,9 +2144,9 @@ sisfb_ioctl(struct inode *inode, struct file *file,
} }
case SISFB_GET_VBRSTATUS: case SISFB_GET_VBRSTATUS:
if(sisfb_CheckVBRetrace(ivideo)) { if(sisfb_CheckVBRetrace(ivideo)) {
return put_user((u32)1, (u32 *) arg); return put_user((u32)1, argp);
} else { } else {
return put_user((u32)0, (u32 *) arg); return put_user((u32)0, argp);
} }
case SISFB_GET_AUTOMAXIMIZE_OLD: case SISFB_GET_AUTOMAXIMIZE_OLD:
...@@ -2153,22 +2154,22 @@ sisfb_ioctl(struct inode *inode, struct file *file, ...@@ -2153,22 +2154,22 @@ sisfb_ioctl(struct inode *inode, struct file *file,
printk(KERN_INFO "sisfb: Deprecated ioctl call received - update your application!\n"); printk(KERN_INFO "sisfb: Deprecated ioctl call received - update your application!\n");
} }
case SISFB_GET_AUTOMAXIMIZE: case SISFB_GET_AUTOMAXIMIZE:
if(ivideo->sisfb_max) return put_user((u32)1, (u32 *)arg); if(ivideo->sisfb_max) return put_user((u32)1, argp);
else return put_user((u32)0, (u32 *)arg); else return put_user((u32)0, argp);
case SISFB_SET_AUTOMAXIMIZE_OLD: case SISFB_SET_AUTOMAXIMIZE_OLD:
if(++count < 50) { if(++count < 50) {
printk(KERN_INFO "sisfb: Deprecated ioctl call received - update your application!\n"); printk(KERN_INFO "sisfb: Deprecated ioctl call received - update your application!\n");
} }
case SISFB_SET_AUTOMAXIMIZE: case SISFB_SET_AUTOMAXIMIZE:
if(copy_from_user(&gpu32, (u32 *)arg, sizeof(gpu32))) { if(copy_from_user(&gpu32, argp, sizeof(gpu32))) {
return -EFAULT; return -EFAULT;
} }
ivideo->sisfb_max = (gpu32) ? 1 : 0; ivideo->sisfb_max = (gpu32) ? 1 : 0;
break; break;
case SISFB_SET_TVPOSOFFSET: case SISFB_SET_TVPOSOFFSET:
if(copy_from_user(&gpu32, (u32 *)arg, sizeof(gpu32))) { if(copy_from_user(&gpu32, argp, sizeof(gpu32))) {
return -EFAULT; return -EFAULT;
} }
sisfb_set_TVxposoffset(ivideo, ((int)(gpu32 >> 16)) - 32); sisfb_set_TVxposoffset(ivideo, ((int)(gpu32 >> 16)) - 32);
...@@ -2176,10 +2177,10 @@ sisfb_ioctl(struct inode *inode, struct file *file, ...@@ -2176,10 +2177,10 @@ sisfb_ioctl(struct inode *inode, struct file *file,
break; break;
case SISFB_GET_TVPOSOFFSET: case SISFB_GET_TVPOSOFFSET:
return put_user((u32)(((ivideo->tvxpos+32)<<16)|((ivideo->tvypos+32)&0xffff)), (u32 *)arg); return put_user((u32)(((ivideo->tvxpos+32)<<16)|((ivideo->tvypos+32)&0xffff)), argp);
case SISFB_SET_LOCK: case SISFB_SET_LOCK:
if(copy_from_user(&gpu32, (u32 *)arg, sizeof(gpu32))) { if(copy_from_user(&gpu32, argp, sizeof(gpu32))) {
return -EFAULT; return -EFAULT;
} }
ivideo->sisfblocked = (gpu32) ? 1 : 0; ivideo->sisfblocked = (gpu32) ? 1 : 0;
...@@ -4761,7 +4762,7 @@ int __devinit sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -4761,7 +4762,7 @@ int __devinit sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
} else { } else {
struct sis_video_info *countvideo = card_list; struct sis_video_info *countvideo = card_list;
ivideo->cardnumber = 1; ivideo->cardnumber = 1;
while((countvideo = countvideo->next)) ivideo->cardnumber++; while ((countvideo = countvideo->next) != NULL) ivideo->cardnumber++;
} }
strncpy(ivideo->myid, chipinfo->chip_name, 30); strncpy(ivideo->myid, chipinfo->chip_name, 30);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment