]> git.baikalelectronics.ru Git - kernel.git/commit
staging: kpc2000: kpc_i2c: prevent memory leak in probe() error case
authorGeordan Neukum <gneukum1@gmail.com>
Sat, 18 May 2019 02:29:58 +0000 (02:29 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 May 2019 08:29:01 +0000 (10:29 +0200)
commita03ee36308ee2f968d590595bcd9bbc59548ffc0
tree10428919e97640ee9886cb5f17097c37ca9b3104
parent1cdec762fb1ef589364700ea5a0a4625358adaf3
staging: kpc2000: kpc_i2c: prevent memory leak in probe() error case

The probe() function performs a kzalloc to dynamically allocate memory
at runtime. If the allocation succeeds, yet invoking the function
i2c_add_adapter fails, the dynamically allocated memory is never freed.
Change the allocation to use the managed allocation API instead and
remove the manual freeing of the memory in the remove() function.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/kpc2000/kpc_i2c/i2c_driver.c