greybus: vibrator: fix tear-down race
Do not release the minor number until after the device has been
deregistered.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
diff --git a/drivers/staging/greybus/vibrator.c b/drivers/staging/greybus/vibrator.c
index 96d649a..fd40cda 100644
--- a/drivers/staging/greybus/vibrator.c
+++ b/drivers/staging/greybus/vibrator.c
@@ -148,8 +148,8 @@
#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,11,0)
sysfs_remove_group(&vib->dev->kobj, vibrator_groups[0]);
#endif
- ida_simple_remove(&minors, vib->minor);
device_unregister(vib->dev);
+ ida_simple_remove(&minors, vib->minor);
kfree(vib);
}