diff options
Diffstat (limited to 'drivers/usb/image/mdc800.c')
-rw-r--r-- | drivers/usb/image/mdc800.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c index a330a4b50e16..1d973bcf56aa 100644 --- a/drivers/usb/image/mdc800.c +++ b/drivers/usb/image/mdc800.c | |||
@@ -425,9 +425,8 @@ static void mdc800_usb_download_notify (struct urb *urb, struct pt_regs *res) | |||
425 | static struct usb_driver mdc800_usb_driver; | 425 | static struct usb_driver mdc800_usb_driver; |
426 | static struct file_operations mdc800_device_ops; | 426 | static struct file_operations mdc800_device_ops; |
427 | static struct usb_class_driver mdc800_class = { | 427 | static struct usb_class_driver mdc800_class = { |
428 | .name = "usb/mdc800%d", | 428 | .name = "mdc800%d", |
429 | .fops = &mdc800_device_ops, | 429 | .fops = &mdc800_device_ops, |
430 | .mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, | ||
431 | .minor_base = MDC800_DEVICE_MINOR_BASE, | 430 | .minor_base = MDC800_DEVICE_MINOR_BASE, |
432 | }; | 431 | }; |
433 | 432 | ||
@@ -976,13 +975,13 @@ static struct usb_driver mdc800_usb_driver = | |||
976 | Init and Cleanup this driver (Main Functions) | 975 | Init and Cleanup this driver (Main Functions) |
977 | *************************************************************************/ | 976 | *************************************************************************/ |
978 | 977 | ||
979 | #define try(A) if (!(A)) goto cleanup_on_fail; | ||
980 | |||
981 | static int __init usb_mdc800_init (void) | 978 | static int __init usb_mdc800_init (void) |
982 | { | 979 | { |
983 | int retval = -ENODEV; | 980 | int retval = -ENODEV; |
984 | /* Allocate Memory */ | 981 | /* Allocate Memory */ |
985 | try (mdc800=kmalloc (sizeof (struct mdc800_data), GFP_KERNEL)); | 982 | mdc800=kmalloc (sizeof (struct mdc800_data), GFP_KERNEL); |
983 | if (!mdc800) | ||
984 | goto cleanup_on_fail; | ||
986 | 985 | ||
987 | memset(mdc800, 0, sizeof(struct mdc800_data)); | 986 | memset(mdc800, 0, sizeof(struct mdc800_data)); |
988 | mdc800->dev = NULL; | 987 | mdc800->dev = NULL; |
@@ -998,13 +997,25 @@ static int __init usb_mdc800_init (void) | |||
998 | mdc800->downloaded = 0; | 997 | mdc800->downloaded = 0; |
999 | mdc800->written = 0; | 998 | mdc800->written = 0; |
1000 | 999 | ||
1001 | try (mdc800->irq_urb_buffer=kmalloc (8, GFP_KERNEL)); | 1000 | mdc800->irq_urb_buffer=kmalloc (8, GFP_KERNEL); |
1002 | try (mdc800->write_urb_buffer=kmalloc (8, GFP_KERNEL)); | 1001 | if (!mdc800->irq_urb_buffer) |
1003 | try (mdc800->download_urb_buffer=kmalloc (64, GFP_KERNEL)); | 1002 | goto cleanup_on_fail; |
1003 | mdc800->write_urb_buffer=kmalloc (8, GFP_KERNEL); | ||
1004 | if (!mdc800->write_urb_buffer) | ||
1005 | goto cleanup_on_fail; | ||
1006 | mdc800->download_urb_buffer=kmalloc (64, GFP_KERNEL); | ||
1007 | if (!mdc800->download_urb_buffer) | ||
1008 | goto cleanup_on_fail; | ||
1004 | 1009 | ||
1005 | try (mdc800->irq_urb=usb_alloc_urb (0, GFP_KERNEL)); | 1010 | mdc800->irq_urb=usb_alloc_urb (0, GFP_KERNEL); |
1006 | try (mdc800->download_urb=usb_alloc_urb (0, GFP_KERNEL)); | 1011 | if (!mdc800->irq_urb) |
1007 | try (mdc800->write_urb=usb_alloc_urb (0, GFP_KERNEL)); | 1012 | goto cleanup_on_fail; |
1013 | mdc800->download_urb=usb_alloc_urb (0, GFP_KERNEL); | ||
1014 | if (!mdc800->download_urb) | ||
1015 | goto cleanup_on_fail; | ||
1016 | mdc800->write_urb=usb_alloc_urb (0, GFP_KERNEL); | ||
1017 | if (!mdc800->write_urb) | ||
1018 | goto cleanup_on_fail; | ||
1008 | 1019 | ||
1009 | /* Register the driver */ | 1020 | /* Register the driver */ |
1010 | retval = usb_register(&mdc800_usb_driver); | 1021 | retval = usb_register(&mdc800_usb_driver); |