aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/sisusbvga/sisusb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/misc/sisusbvga/sisusb.c')
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index 022dc0008f2a..306d6852ebc7 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -2316,10 +2316,12 @@ sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init)
2316 /* Set mode 0x03 */ 2316 /* Set mode 0x03 */
2317 SiSUSBSetMode(sisusb->SiS_Pr, 0x03); 2317 SiSUSBSetMode(sisusb->SiS_Pr, 0x03);
2318 2318
2319 if (!(myfont = find_font("VGA8x16"))) 2319 myfont = find_font("VGA8x16");
2320 if (!myfont)
2320 return 1; 2321 return 1;
2321 2322
2322 if (!(tempbuf = vmalloc(8192))) 2323 tempbuf = vmalloc(8192);
2324 if (!tempbuf)
2323 return 1; 2325 return 1;
2324 2326
2325 for (i = 0; i < 256; i++) 2327 for (i = 0; i < 256; i++)
@@ -2342,7 +2344,8 @@ sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init)
2342 2344
2343 if (init && !sisusb->scrbuf) { 2345 if (init && !sisusb->scrbuf) {
2344 2346
2345 if ((tempbuf = vmalloc(8192))) { 2347 tempbuf = vmalloc(8192);
2348 if (tempbuf) {
2346 2349
2347 i = 4096; 2350 i = 4096;
2348 tempbufb = (u16 *)tempbuf; 2351 tempbufb = (u16 *)tempbuf;
@@ -2417,11 +2420,13 @@ sisusb_open(struct inode *inode, struct file *file)
2417 struct usb_interface *interface; 2420 struct usb_interface *interface;
2418 int subminor = iminor(inode); 2421 int subminor = iminor(inode);
2419 2422
2420 if (!(interface = usb_find_interface(&sisusb_driver, subminor))) { 2423 interface = usb_find_interface(&sisusb_driver, subminor);
2424 if (!interface) {
2421 return -ENODEV; 2425 return -ENODEV;
2422 } 2426 }
2423 2427
2424 if (!(sisusb = usb_get_intfdata(interface))) { 2428 sisusb = usb_get_intfdata(interface);
2429 if (!sisusb) {
2425 return -ENODEV; 2430 return -ENODEV;
2426 } 2431 }
2427 2432
@@ -2488,7 +2493,8 @@ sisusb_release(struct inode *inode, struct file *file)
2488{ 2493{
2489 struct sisusb_usb_data *sisusb; 2494 struct sisusb_usb_data *sisusb;
2490 2495
2491 if (!(sisusb = file->private_data)) 2496 sisusb = file->private_data;
2497 if (!sisusb)
2492 return -ENODEV; 2498 return -ENODEV;
2493 2499
2494 mutex_lock(&sisusb->lock); 2500 mutex_lock(&sisusb->lock);
@@ -2520,7 +2526,8 @@ sisusb_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
2520 u16 buf16; 2526 u16 buf16;
2521 u32 buf32, address; 2527 u32 buf32, address;
2522 2528
2523 if (!(sisusb = file->private_data)) 2529 sisusb = file->private_data;
2530 if (!sisusb)
2524 return -ENODEV; 2531 return -ENODEV;
2525 2532
2526 mutex_lock(&sisusb->lock); 2533 mutex_lock(&sisusb->lock);
@@ -2662,7 +2669,8 @@ sisusb_write(struct file *file, const char __user *buffer, size_t count,
2662 u16 buf16; 2669 u16 buf16;
2663 u32 buf32, address; 2670 u32 buf32, address;
2664 2671
2665 if (!(sisusb = file->private_data)) 2672 sisusb = file->private_data;
2673 if (!sisusb)
2666 return -ENODEV; 2674 return -ENODEV;
2667 2675
2668 mutex_lock(&sisusb->lock); 2676 mutex_lock(&sisusb->lock);
@@ -2805,7 +2813,8 @@ sisusb_lseek(struct file *file, loff_t offset, int orig)
2805 struct sisusb_usb_data *sisusb; 2813 struct sisusb_usb_data *sisusb;
2806 loff_t ret; 2814 loff_t ret;
2807 2815
2808 if (!(sisusb = file->private_data)) 2816 sisusb = file->private_data;
2817 if (!sisusb)
2809 return -ENODEV; 2818 return -ENODEV;
2810 2819
2811 mutex_lock(&sisusb->lock); 2820 mutex_lock(&sisusb->lock);
@@ -2970,7 +2979,8 @@ sisusb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2970 long retval = 0; 2979 long retval = 0;
2971 u32 __user *argp = (u32 __user *)arg; 2980 u32 __user *argp = (u32 __user *)arg;
2972 2981
2973 if (!(sisusb = file->private_data)) 2982 sisusb = file->private_data;
2983 if (!sisusb)
2974 return -ENODEV; 2984 return -ENODEV;
2975 2985
2976 mutex_lock(&sisusb->lock); 2986 mutex_lock(&sisusb->lock);
@@ -3084,7 +3094,8 @@ static int sisusb_probe(struct usb_interface *intf,
3084 dev->devnum); 3094 dev->devnum);
3085 3095
3086 /* Allocate memory for our private */ 3096 /* Allocate memory for our private */
3087 if (!(sisusb = kzalloc(sizeof(*sisusb), GFP_KERNEL))) { 3097 sisusb = kzalloc(sizeof(*sisusb), GFP_KERNEL);
3098 if (!sisusb) {
3088 dev_err(&dev->dev, "Failed to allocate memory for private data\n"); 3099 dev_err(&dev->dev, "Failed to allocate memory for private data\n");
3089 return -ENOMEM; 3100 return -ENOMEM;
3090 } 3101 }
@@ -3093,7 +3104,8 @@ static int sisusb_probe(struct usb_interface *intf,
3093 mutex_init(&(sisusb->lock)); 3104 mutex_init(&(sisusb->lock));
3094 3105
3095 /* Register device */ 3106 /* Register device */
3096 if ((retval = usb_register_dev(intf, &usb_sisusb_class))) { 3107 retval = usb_register_dev(intf, &usb_sisusb_class);
3108 if (retval) {
3097 dev_err(&sisusb->sisusb_dev->dev, "Failed to get a minor for device %d\n", 3109 dev_err(&sisusb->sisusb_dev->dev, "Failed to get a minor for device %d\n",
3098 dev->devnum); 3110 dev->devnum);
3099 retval = -ENODEV; 3111 retval = -ENODEV;
@@ -3214,7 +3226,8 @@ static void sisusb_disconnect(struct usb_interface *intf)
3214 struct sisusb_usb_data *sisusb; 3226 struct sisusb_usb_data *sisusb;
3215 3227
3216 /* This should *not* happen */ 3228 /* This should *not* happen */
3217 if (!(sisusb = usb_get_intfdata(intf))) 3229 sisusb = usb_get_intfdata(intf);
3230 if (!sisusb)
3218 return; 3231 return;
3219 3232
3220#ifdef INCL_SISUSB_CON 3233#ifdef INCL_SISUSB_CON