From: Johan Hovold Date: Tue, 13 Oct 2015 17:10:27 +0000 (+0200) Subject: greybus: vibrator: add missing protocol-register error handling X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d4efa68803667ab9d3ff6786462d2702b89e58de;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Greg Kroah-Hartman --- 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);