Commit dd671a39481eaf8ebd512ea8cba25d62066d078f
Committed by
Greg Kroah-Hartman
1 parent
5351035258
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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 <hsweeten@visionengravers.com> Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff
drivers/staging/comedi/drivers/unioxx5.c
... | ... | @@ -375,14 +375,14 @@ |
375 | 375 | int i, to, ndef_flag = 0; |
376 | 376 | int ret; |
377 | 377 | |
378 | + usp = kzalloc(sizeof(*usp), GFP_KERNEL); | |
379 | + if (usp == NULL) | |
380 | + return -ENOMEM; | |
381 | + | |
378 | 382 | ret = __comedi_request_region(dev, iobase, UNIOXX5_SIZE); |
379 | 383 | if (ret) |
380 | 384 | return ret; |
381 | 385 | usp->usp_iobase = iobase; |
382 | - | |
383 | - usp = kzalloc(sizeof(*usp), GFP_KERNEL); | |
384 | - if (usp == NULL) | |
385 | - return -ENOMEM; | |
386 | 386 | |
387 | 387 | /* defining modules types */ |
388 | 388 | for (i = 0; i < 12; i++) { |