All of lore.kernel.org
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v2] android/avctp: Fix reference counting
Date: Mon, 30 Mar 2015 12:03:31 +0200	[thread overview]
Message-ID: <2377316.UHsmVUP4OF@leonov> (raw)
In-Reply-To: <1427496535-17777-1-git-send-email-szymon.janc@tieto.com>

On Friday 27 of March 2015 23:48:55 Szymon Janc wrote:
> Drop extra reference before exiting function.
> ---
> V2: get ref before loop and drop after
> 
>  android/avctp.c | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/android/avctp.c b/android/avctp.c
> index d1d2f95..6d7d8cf 100644
> --- a/android/avctp.c
> +++ b/android/avctp.c
> @@ -775,6 +775,8 @@ static void control_response(struct avctp_channel
> *control, control);
>  	}
> 
> +	avctp_ref(control->session);
> +
>  	for (l = control->processed; l; l = l->next) {
>  		p = l->data;
>  		req = p->data;
> @@ -788,15 +790,15 @@ static void control_response(struct avctp_channel
> *control, avc->subunit_type,
>  						operands, operand_count,
>  						req->user_data))
> -			return;
> +			break;
> 
>  		control->processed = g_slist_remove(control->processed, p);
>  		pending_destroy(p, NULL);
> 
> -		avctp_unref(control->session);
> -
> -		return;
> +		break;
>  	}
> +
> +	avctp_unref(control->session);
>  }
> 
>  static void browsing_response(struct avctp_channel *browsing,
> @@ -823,6 +825,8 @@ static void browsing_response(struct avctp_channel
> *browsing, browsing);
>  	}
> 
> +	avctp_ref(browsing->session);
> +
>  	for (l = browsing->processed; l; l = l->next) {
>  		p = l->data;
>  		req = p->data;
> @@ -830,17 +834,17 @@ static void browsing_response(struct avctp_channel
> *browsing, if (p->transaction != avctp->transaction)
>  			continue;
> 
> -		avctp_ref(browsing->session);
> -
>  		if (req->func && req->func(browsing->session, operands,
>  						operand_count, req->user_data))
> -			return;
> +			break;
> 
>  		browsing->processed = g_slist_remove(browsing->processed, p);
>  		pending_destroy(p, NULL);
> 
> -		return;
> +		break;
>  	}
> +
> +	avctp_unref(browsing->session);
>  }
> 
>  static gboolean session_browsing_cb(GIOChannel *chan, GIOCondition cond,

Applied.

-- 
BR
Szymon Janc

      reply	other threads:[~2015-03-30 10:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27 22:48 [PATCH v2] android/avctp: Fix reference counting Szymon Janc
2015-03-30 10:03 ` Szymon Janc [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=2377316.UHsmVUP4OF@leonov \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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 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.