All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: greybus: fix an error handling bug in gb_svc_hello()
@ 2022-02-02  7:20 Dan Carpenter
  2022-02-02 10:27 ` Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-02-02  7:20 UTC (permalink / raw)
  To: Johan Hovold, Mitchell Tasman
  Cc: Alex Elder, Greg Kroah-Hartman, greybus-dev, linux-kernel,
	kernel-janitors

Cleanup if gb_svc_queue_deferred_request() fails.

Fixes: ee2f2074fdb2 ("greybus: svc: reconfig APBridgeA-Switch link to handle required load")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
From static analysis.  Not tested.

 drivers/greybus/svc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/greybus/svc.c b/drivers/greybus/svc.c
index ce7740ef449b..b19651048081 100644
--- a/drivers/greybus/svc.c
+++ b/drivers/greybus/svc.c
@@ -866,8 +866,14 @@ static int gb_svc_hello(struct gb_operation *op)
 
 	gb_svc_debugfs_init(svc);
 
-	return gb_svc_queue_deferred_request(op);
+	ret = gb_svc_queue_deferred_request(op);
+	if (ret)
+		goto remove_debugfs;
+
+	return 0;
 
+remove_debugfs:
+	gb_svc_debugfs_exit(svc);
 err_unregister_device:
 	gb_svc_watchdog_destroy(svc);
 	device_del(&svc->dev);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: greybus: fix an error handling bug in gb_svc_hello()
  2022-02-02  7:20 [PATCH] staging: greybus: fix an error handling bug in gb_svc_hello() Dan Carpenter
@ 2022-02-02 10:27 ` Johan Hovold
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2022-02-02 10:27 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Mitchell Tasman, Alex Elder, Greg Kroah-Hartman, greybus-dev,
	linux-kernel, kernel-janitors

On Wed, Feb 02, 2022 at 10:20:16AM +0300, Dan Carpenter wrote:
> Cleanup if gb_svc_queue_deferred_request() fails.
> 
> Fixes: ee2f2074fdb2 ("greybus: svc: reconfig APBridgeA-Switch link to handle required load")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> From static analysis.  Not tested.

Look correct. Thanks, Dan.

This part of Greybus no longer lives in staging and the prefix should be

	greybus: svc:

I'd also prefer to see all error labels use an err_ prefix consistently.

When looking at this code I found another bug so I'll fix up the above
nits and send a series with both fixes as there will be a dependency.

>  drivers/greybus/svc.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/greybus/svc.c b/drivers/greybus/svc.c
> index ce7740ef449b..b19651048081 100644
> --- a/drivers/greybus/svc.c
> +++ b/drivers/greybus/svc.c
> @@ -866,8 +866,14 @@ static int gb_svc_hello(struct gb_operation *op)
>  
>  	gb_svc_debugfs_init(svc);
>  
> -	return gb_svc_queue_deferred_request(op);
> +	ret = gb_svc_queue_deferred_request(op);
> +	if (ret)
> +		goto remove_debugfs;
> +
> +	return 0;
>  
> +remove_debugfs:
> +	gb_svc_debugfs_exit(svc);
>  err_unregister_device:
>  	gb_svc_watchdog_destroy(svc);
>  	device_del(&svc->dev);

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-02 10:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02  7:20 [PATCH] staging: greybus: fix an error handling bug in gb_svc_hello() Dan Carpenter
2022-02-02 10:27 ` Johan Hovold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.