aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2022-02-02 12:33:46 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-04 15:27:44 +0100
commit5f648e00f50ff8b04a4cfe13d58a0227bc2b56bb (patch)
treedf1c904bd28ed4a749b1ccdb0732b4741baaba12
parentgreybus: svc: fix an error handling bug in gb_svc_hello() (diff)
downloadlinux-dev-5f648e00f50ff8b04a4cfe13d58a0227bc2b56bb.tar.xz
linux-dev-5f648e00f50ff8b04a4cfe13d58a0227bc2b56bb.zip
greybus: svc: clean up hello error path
While currently safe, it is unnecessary (and confusing) to try to destroy the watchdog when watchdog creation fails. Change the corresponding error path to only deregister the svc. Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://lore.kernel.org/r/20220202113347.1288-3-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/greybus/svc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/greybus/svc.c b/drivers/greybus/svc.c
index 51d0875a3480..4f93d6b2f4ed 100644
--- a/drivers/greybus/svc.c
+++ b/drivers/greybus/svc.c
@@ -861,7 +861,7 @@ static int gb_svc_hello(struct gb_operation *op)
ret = gb_svc_watchdog_create(svc);
if (ret) {
dev_err(&svc->dev, "failed to create watchdog: %d\n", ret);
- goto err_unregister_device;
+ goto err_deregister_svc;
}
gb_svc_debugfs_init(svc);
@@ -874,9 +874,10 @@ static int gb_svc_hello(struct gb_operation *op)
err_remove_debugfs:
gb_svc_debugfs_exit(svc);
-err_unregister_device:
gb_svc_watchdog_destroy(svc);
+err_deregister_svc:
device_del(&svc->dev);
+
return ret;
}