staging: comedi: unionxx5: allocate 'usp' before using it
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 12 Apr 2013 16:58:45 +0000 (09:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 12 Apr 2013 22:09:59 +0000 (15:09 -0700)
As reported by the kbuild test robot, the 'usp' pointer needs to be
allocated before being used.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/unioxx5.c

index 6661cf72cc1fb7b2dc806d2a819a0aca096d94f5..1b19cc246ab27073c42ace7f6802e47fcada41de 100644 (file)
@@ -375,15 +375,15 @@ static int __unioxx5_subdev_init(struct comedi_device *dev,
        int i, to, ndef_flag = 0;
        int ret;
 
+       usp = kzalloc(sizeof(*usp), GFP_KERNEL);
+       if (usp == NULL)
+               return -ENOMEM;
+
        ret = __comedi_request_region(dev, iobase, UNIOXX5_SIZE);
        if (ret)
                return ret;
        usp->usp_iobase = iobase;
 
-       usp = kzalloc(sizeof(*usp), GFP_KERNEL);
-       if (usp == NULL)
-               return -ENOMEM;
-
        /* defining modules types */
        for (i = 0; i < 12; i++) {
                to = 10000;