summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/vibrator.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-10-13 19:10:27 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2015-10-14 12:08:50 -0700
commitd4efa68803667ab9d3ff6786462d2702b89e58de (patch)
tree2acd41893b06e5450eaf9bef6fb33f782961c361 /drivers/staging/greybus/vibrator.c
parent4505c4d44a660866f2006eacafcb8c7d182ec182 (diff)
greybus: vibrator: add missing protocol-register error handling
Add missing error handling when registering the vibrator protocol during module init. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/vibrator.c')
-rw-r--r--drivers/staging/greybus/vibrator.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/staging/greybus/vibrator.c b/drivers/staging/greybus/vibrator.c
index fd40cda565e4..2b8032653f55 100644
--- a/drivers/staging/greybus/vibrator.c
+++ b/drivers/staging/greybus/vibrator.c
@@ -171,7 +171,16 @@ static __init int protocol_init(void)
if (retval)
return retval;
- return gb_protocol_register(&vibrator_protocol);
+ retval = gb_protocol_register(&vibrator_protocol);
+ if (retval)
+ goto err_class_unregister;
+
+ return 0;
+
+err_class_unregister:
+ class_unregister(&vibrator_class);
+
+ return retval;
}
module_init(protocol_init);