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>
"vibrator%d", vib->minor);
if (IS_ERR(dev)) {
retval = -EINVAL;
- goto error;
+ goto err_idr_remove;
}
vib->dev = dev;
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;