public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Cc: elder@kernel.org, gregkh@linuxfoundation.org,
	greybus-dev@lists.linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] greybus/operation: Drop reference when message has been sent
Date: Wed, 10 Mar 2021 15:22:56 +0100	[thread overview]
Message-ID: <YEjWQObSkj6QbXZP@hovoldconsulting.com> (raw)
In-Reply-To: <20210310141736.3459-1-lyl2019@mail.ustc.edu.cn>

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

      reply	other threads:[~2021-03-10 14:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YEjWQObSkj6QbXZP@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyl2019@mail.ustc.edu.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox