diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2015-03-17 10:55:51 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <greg@kroah.com> | 2015-03-17 22:32:58 +0100 |
commit | deeb57f5bd990f747815216ab772e92413848f6e (patch) | |
tree | 491d0167faa7a647059851f1d141e863d17d5a51 /drivers/staging/greybus/vibrator.c | |
parent | 6a80ed4d2c26b5934f3bfb9beafe73a9c7946d34 (diff) | |
download | op-kernel-dev-deeb57f5bd990f747815216ab772e92413848f6e.zip op-kernel-dev-deeb57f5bd990f747815216ab772e92413848f6e.tar.gz |
greybus: vibrator: fix memory leak in error path
Fix memory leak in connection_init error path.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'drivers/staging/greybus/vibrator.c')
-rw-r--r-- | drivers/staging/greybus/vibrator.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/greybus/vibrator.c b/drivers/staging/greybus/vibrator.c index b6ec9f2..c92c69e 100644 --- a/drivers/staging/greybus/vibrator.c +++ b/drivers/staging/greybus/vibrator.c @@ -127,7 +127,7 @@ static int gb_vibrator_connection_init(struct gb_connection *connection) "vibrator%d", vib->minor); if (IS_ERR(dev)) { retval = -EINVAL; - goto error; + goto err_idr_remove; } vib->dev = dev; @@ -140,12 +140,14 @@ static int gb_vibrator_connection_init(struct gb_connection *connection) retval = sysfs_create_group(&dev->kobj, vibrator_groups[0]); if (retval) { device_unregister(dev); - goto error; + goto err_idr_remove; } #endif return 0; +err_idr_remove: + idr_remove(&minors, vib->minor); error: kfree(vib); return retval; |