* [PATCH v2] greybus/operation: Drop reference when message has been sent
@ 2021-03-10 14:17 Lv Yunlong
2021-03-10 14:22 ` Johan Hovold
0 siblings, 1 reply; 2+ messages in thread
From: Lv Yunlong @ 2021-03-10 14:17 UTC (permalink / raw)
To: johan, elder, gregkh; +Cc: greybus-dev, linux-kernel, Lv Yunlong
In gb_operation_response_send, get an extra reference
before gb_message_send() with this comment "/* Reference will
be dropped when message has been sent. */". Therefore, we
should drop the got reference not only in the error branch,
but also in the complete branch.
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
---
drivers/greybus/operation.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/greybus/operation.c b/drivers/greybus/operation.c
index 8459e9bc0749..500b3fe53a04 100644
--- a/drivers/greybus/operation.c
+++ b/drivers/greybus/operation.c
@@ -855,6 +855,10 @@ static int gb_operation_response_send(struct gb_operation *operation,
if (ret)
goto err_put_active;
+ /*Drop reference after message send completes. */
+ gb_operation_put_active(operation);
+ gb_operation_put(operation);
+
return 0;
err_put_active:
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] greybus/operation: Drop reference when message has been sent
2021-03-10 14:17 [PATCH v2] greybus/operation: Drop reference when message has been sent Lv Yunlong
@ 2021-03-10 14:22 ` Johan Hovold
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2021-03-10 14:22 UTC (permalink / raw)
To: Lv Yunlong; +Cc: elder, gregkh, greybus-dev, linux-kernel
On Wed, Mar 10, 2021 at 06:17:36AM -0800, Lv Yunlong wrote:
> In gb_operation_response_send, get an extra reference
> before gb_message_send() with this comment "/* Reference will
> be dropped when message has been sent. */". Therefore, we
> should drop the got reference not only in the error branch,
> but also in the complete branch.
>
> Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
> ---
> drivers/greybus/operation.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/greybus/operation.c b/drivers/greybus/operation.c
> index 8459e9bc0749..500b3fe53a04 100644
> --- a/drivers/greybus/operation.c
> +++ b/drivers/greybus/operation.c
> @@ -855,6 +855,10 @@ static int gb_operation_response_send(struct gb_operation *operation,
> if (ret)
> goto err_put_active;
>
> + /*Drop reference after message send completes. */
> + gb_operation_put_active(operation);
> + gb_operation_put(operation);
No, this is broken.
The reference is dropped in greybus_message_sent().
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-10 14:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-10 14:17 [PATCH v2] greybus/operation: Drop reference when message has been sent Lv Yunlong
2021-03-10 14:22 ` Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox