aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/image
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/image')
-rw-r--r--drivers/usb/image/mdc800.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
index e4ec133ee74a..1d973bcf56aa 100644
--- a/drivers/usb/image/mdc800.c
+++ b/drivers/usb/image/mdc800.c
@@ -975,13 +975,13 @@ static struct usb_driver mdc800_usb_driver =
975 Init and Cleanup this driver (Main Functions) 975 Init and Cleanup this driver (Main Functions)
976*************************************************************************/ 976*************************************************************************/
977 977
978#define try(A) if (!(A)) goto cleanup_on_fail;
979
980static int __init usb_mdc800_init (void) 978static int __init usb_mdc800_init (void)
981{ 979{
982 int retval = -ENODEV; 980 int retval = -ENODEV;
983 /* Allocate Memory */ 981 /* Allocate Memory */
984 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;
985 985
986 memset(mdc800, 0, sizeof(struct mdc800_data)); 986 memset(mdc800, 0, sizeof(struct mdc800_data));
987 mdc800->dev = NULL; 987 mdc800->dev = NULL;
@@ -997,13 +997,25 @@ static int __init usb_mdc800_init (void)
997 mdc800->downloaded = 0; 997 mdc800->downloaded = 0;
998 mdc800->written = 0; 998 mdc800->written = 0;
999 999
1000 try (mdc800->irq_urb_buffer=kmalloc (8, GFP_KERNEL)); 1000 mdc800->irq_urb_buffer=kmalloc (8, GFP_KERNEL);
1001 try (mdc800->write_urb_buffer=kmalloc (8, GFP_KERNEL)); 1001 if (!mdc800->irq_urb_buffer)
1002 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;
1003 1009
1004 try (mdc800->irq_urb=usb_alloc_urb (0, GFP_KERNEL)); 1010 mdc800->irq_urb=usb_alloc_urb (0, GFP_KERNEL);
1005 try (mdc800->download_urb=usb_alloc_urb (0, GFP_KERNEL)); 1011 if (!mdc800->irq_urb)
1006 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;
1007 1019
1008 /* Register the driver */ 1020 /* Register the driver */
1009 retval = usb_register(&mdc800_usb_driver); 1021 retval = usb_register(&mdc800_usb_driver);