From: H Hartley Sweeten Date: Fri, 12 Apr 2013 16:58:45 +0000 (-0700) Subject: staging: comedi: unionxx5: allocate 'usp' before using it X-Git-Tag: v3.10-rc1~192^2~74 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd671a39481eaf8ebd512ea8cba25d62066d078f;p=profile%2Fivi%2Fkernel-x86-ivi.git staging: comedi: unionxx5: allocate 'usp' before using it As reported by the kbuild test robot, the 'usp' pointer needs to be allocated before being used. Signed-off-by: H Hartley Sweeten Reported-by: kbuild test robot Signed-off-by: Greg Kroah-Hartman --- 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;