staging: gdm724x: fix leak at failure path in gdm_usb_probe()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Fri, 15 Nov 2013 20:46:24 +0000 (00:46 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Nov 2013 20:29:15 +0000 (12:29 -0800)
commita34c72b348703da43d605441b86a61688ec19a0d
tree895ebe50287fc7b2d09d5fe559a738b10a7d4427
parent5e1284758a6702117b622a4983c5829ea583df2c
staging: gdm724x: fix leak at failure path in gdm_usb_probe()

Error handling code in gdm_usb_probe() deallocates all resources,
but calls usb_get_dev(usbdev) and returns error code after that.

The patch fixes it and, by the way, several other issues:
- no need to use GFP_ATOMIC in probe();
- return -ENODEV instead of -1;
- kmalloc+memset -> kzalloc

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gdm724x/gdm_usb.c