As reported by the kbuild test robot, the 'usp' pointer needs to be
allocated before being used.

Signed-off-by: H Hartley Sweeten <[email protected]>
Reported-by: kbuild test robot <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
---
 drivers/staging/comedi/drivers/unioxx5.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/unioxx5.c 
b/drivers/staging/comedi/drivers/unioxx5.c
index 6661cf7..1b19cc2 100644
--- a/drivers/staging/comedi/drivers/unioxx5.c
+++ b/drivers/staging/comedi/drivers/unioxx5.c
@@ -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;
-- 
1.8.1.4

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

Reply via email to