Linux wireless drivers development
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@codeaurora.org>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] mt76: fix sparse warnings: warning: dubious: x & !y
Date: Tue, 18 Jun 2019 15:36:36 +0300	[thread overview]
Message-ID: <871rzr9ijv.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <20190618121641.GA20044@localhost.localdomain> (Lorenzo Bianconi's message of "Tue, 18 Jun 2019 14:16:42 +0200")

(I think you accidentally dropped linux-wireless, adding it back)

Lorenzo Bianconi <lorenzo@kernel.org> writes:

>> Lorenzo Bianconi <lorenzo@kernel.org> writes:
>> 
>> > Fix following sparse warnings in mt7603/mac.c and mt76x02_mac.c
>> >
>> > drivers/net/wireless/mediatek/mt76/mt76x02_mac.c:113:17: warning: dubious: x & !y
>> > drivers/net/wireless/mediatek/mt76/mt76x02_mac.c:145:16: warning: dubious: x & !y
>> > drivers/net/wireless/mediatek/mt76/mt7603/mac.c:730:9: warning: dubious: x & !y
>> > drivers/net/wireless/mediatek/mt76/mt7603/mac.c:790:15: warning: dubious: x & !y
>> >
>> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
>> > ---
>> >  drivers/net/wireless/mediatek/mt76/mt7603/mac.c  | 6 ++++--
>> >  drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 7 +++++--
>> >  2 files changed, 9 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
>> > index ab5141701997..62e0a7f4716a 100644
>> > --- a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
>> > +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
>> > @@ -709,6 +709,7 @@ int mt7603_wtbl_set_key(struct mt7603_dev *dev, int wcid,
>> >  {
>> >  	enum mt7603_cipher_type cipher;
>> >  	u32 addr = mt7603_wtbl3_addr(wcid);
>> > +	bool key_set = !!key;
>> >  	u8 key_data[32];
>> >  	int key_len = sizeof(key_data);
>> >  
>> > @@ -727,7 +728,7 @@ int mt7603_wtbl_set_key(struct mt7603_dev *dev, int wcid,
>> >  	mt76_rmw_field(dev, addr + 2 * 4, MT_WTBL1_W2_KEY_TYPE, cipher);
>> >  	if (key)
>> >  		mt76_rmw_field(dev, addr, MT_WTBL1_W0_KEY_IDX, key->keyidx);
>> > -	mt76_rmw_field(dev, addr, MT_WTBL1_W0_RX_KEY_VALID, !!key);
>> > +	mt76_rmw_field(dev, addr, MT_WTBL1_W0_RX_KEY_VALID, key_set);
>> 
>> I'm not seeing you really _fixing_ anything here, you are just working
>> around a sparse warning by adding an extra variable. I'm having a hard
>> time to see the benefit from that, it's just an unnecessary variable.
>
> Hi Kalle,
>
> right, they are just false positive, I posted this patch since they are
> annoying and sometimes sparse spots real bugs so I think it would be better to
> remove 'noise' sources.

Sure, sparse is very useful. I run it for every ath10k and ath11k patch
and it has found a lot of valid issues.

> Anyway we can drop this patch, I did not come up with a better
> solution :)

I was lazy and I added a filter to my ath11k-check to skip this warning.
It would be nice report this to sparse developers, as we already have
two drivers suffering of the same problem.

-- 
Kalle Valo

      parent reply	other threads:[~2019-06-18 12:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-18 10:02 [PATCH] mt76: fix sparse warnings: warning: dubious: x & !y Lorenzo Bianconi
2019-06-18 12:08 ` Kalle Valo
     [not found]   ` <20190618121641.GA20044@localhost.localdomain>
2019-06-18 12:36     ` Kalle Valo [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=871rzr9ijv.fsf@kamboji.qca.qualcomm.com \
    --to=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox