[PATCH] staging: comedi: unionxx5: allocate 'usp' before using it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Reported-by: kbuild test robot <fengguang.wu@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 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
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux