diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2016-01-21 17:34:22 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-01-21 22:46:38 -0800 |
commit | 5dd8cc5370dbf68f17ed9443be6bcc54afbef204 (patch) | |
tree | 36474e9562c7bb70165796318743c3fd92e43fd8 | |
parent | f7ee081e3151e187e7478eb8941f61744f125201 (diff) |
greybus: hid: clean up init error paths
Separate success and error paths more clearly.
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
-rw-r--r-- | drivers/staging/greybus/hid.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/staging/greybus/hid.c b/drivers/staging/greybus/hid.c index f45b444716ba..51657b06ea73 100644 --- a/drivers/staging/greybus/hid.c +++ b/drivers/staging/greybus/hid.c @@ -431,7 +431,7 @@ static int gb_hid_connection_init(struct gb_connection *connection) hid = hid_allocate_device(); if (IS_ERR(hid)) { ret = PTR_ERR(hid); - goto free_ghid; + goto err_free_ghid; } connection->private = ghid; @@ -440,17 +440,19 @@ static int gb_hid_connection_init(struct gb_connection *connection) ret = gb_hid_init(ghid); if (ret) - goto destroy_hid; + goto err_destroy_hid; ret = hid_add_device(hid); - if (!ret) - return 0; + if (ret) { + hid_err(hid, "can't add hid device: %d\n", ret); + goto err_destroy_hid; + } - hid_err(hid, "can't add hid device: %d\n", ret); + return 0; -destroy_hid: +err_destroy_hid: hid_destroy_device(hid); -free_ghid: +err_free_ghid: kfree(ghid); return ret; |