[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YEjWQObSkj6QbXZP@hovoldconsulting.com>
Date: Wed, 10 Mar 2021 15:22:56 +0100
From: Johan Hovold <johan@...nel.org>
To: Lv Yunlong <lyl2019@...l.ustc.edu.cn>
Cc: elder@...nel.org, gregkh@...uxfoundation.org,
greybus-dev@...ts.linaro.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] greybus/operation: Drop reference when message has
been sent
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@...l.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
Powered by blists - more mailing lists