From dd671a39481eaf8ebd512ea8cba25d62066d078f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 12 Apr 2013 09:58:45 -0700 Subject: [PATCH] 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 --- 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 6661cf72cc1f..1b19cc246ab2 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; -- 2.39.5