linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
To: Szymon Janc <szymon.janc@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] android/gatt: Fix dead code warnings
Date: Tue, 11 Nov 2014 10:22:43 +0200	[thread overview]
Message-ID: <20141111082205.GA9152@aemeltch-MOBL1> (raw)
In-Reply-To: <1584207.SFKaHYrozt@leonov>

Hi Szymon,

On Mon, Nov 10, 2014 at 09:05:41PM +0100, Szymon Janc wrote:
> Hi Andrei,
> 
> On Monday 10 of November 2014 15:25:18 Andrei Emeltchenko wrote:
> > From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> > 
> > gatt_db_attribute_get_permissions() used everywhere without check since
> > those conditions are checked already.
> 
> It would make sense to put such warning into commit message if you are 
> referring to it in subject.
> 
> > ---
> >  android/gatt.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/android/gatt.c b/android/gatt.c
> > index 086bb94..04101f6 100644
> > --- a/android/gatt.c
> > +++ b/android/gatt.c
> > @@ -5992,8 +5992,7 @@ static void write_cmd_request(const uint8_t *cmd,
> > uint16_t cmd_len, if (!attrib)
> >  		return;
> > 
> > -	if (!gatt_db_attribute_get_permissions(attrib, &permissions))
> > -		return;
> > +	gatt_db_attribute_get_permissions(attrib, &permissions);
> > 
> >  	if (check_device_permissions(dev, cmd[0], permissions))
> >  		return;
> 
> So if we always pass valid pointers to this function, then maybe we should 
> change it definition to something like:
> 
> uint32_t gatt_db_attribute_get_permissions(struct gatt_db_attribute *attrib);
> 

Do we really need a helper which just does reference?

Best regards 
Andrei Emeltchenko 

  reply	other threads:[~2014-11-11  8:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-10 13:25 [PATCH] android/gatt: Fix dead code warnings Andrei Emeltchenko
2014-11-10 20:05 ` Szymon Janc
2014-11-11  8:22   ` Andrei Emeltchenko [this message]
2014-11-13 13:24     ` Szymon Janc
2014-11-13 13:33       ` Andrei Emeltchenko
2014-11-13 17:13   ` [PATCHv2] android/gatt: Simplify gatt_db_attribute_get_permissions() Andrei Emeltchenko
2014-11-17 13:03     ` Andrei Emeltchenko
2014-11-18 12:15       ` Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2014-12-19  9:24 [PATCH] android/gatt: Fix dead code warnings Andrei Emeltchenko
2014-12-19 10:07 ` Szymon Janc
2014-12-19 10:14   ` Andrei Emeltchenko
2014-12-19 10:15     ` Szymon Janc
2014-12-19 10:22       ` Andrei Emeltchenko
2015-01-08 14:19 ` Andrei Emeltchenko

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=20141111082205.GA9152@aemeltch-MOBL1 \
    --to=andrei.emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=szymon.janc@tieto.com \
    /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;
as well as URLs for NNTP newsgroup(s).