From: Dan Carpenter <error27@gmail.com>
To: Ping-Ke Shih <pkshih@realtek.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [bug report] rtw89: add Realtek 802.11ax driver
Date: Tue, 13 Dec 2022 07:21:05 +0300 [thread overview]
Message-ID: <Y5f9sUhoY/vqy0cQ@kadam> (raw)
In-Reply-To: <e87d10cd962d4d118b86a280f986f6ef@realtek.com>
On Tue, Dec 13, 2022 at 12:46:22AM +0000, Ping-Ke Shih wrote:
>
>
> > -----Original Message-----
> > From: Dan Carpenter <error27@gmail.com>
> > Sent: Monday, December 12, 2022 11:34 PM
> > To: Ping-Ke Shih <pkshih@realtek.com>
> > Cc: linux-wireless@vger.kernel.org
> > Subject: [bug report] rtw89: add Realtek 802.11ax driver
> >
> > Hello Ping-Ke Shih,
> >
> > The patch e3ec7017f6a2: "rtw89: add Realtek 802.11ax driver" from Oct
> > 11, 2021, leads to the following potential issue (just from reading
> > the code):
> >
> > drivers/net/wireless/realtek/rtw89/core.h
> > 3878 static inline u32
> > 3879 rtw89_read32_mask(struct rtw89_dev *rtwdev, u32 addr, u32 mask)
> > 3880 {
> > 3881 u32 shift = __ffs(mask);
> > 3882 u32 orig;
> > 3883 u32 ret;
> > 3884
> > 3885 orig = rtw89_read32(rtwdev, addr);
> > --> 3886 ret = (orig & mask) >> shift;
> >
> > I think this line should be:
> >
> > ret = (orig & mask) >> (shift - 1);
> >
> > A typical mask here is 0xff so __ffs() is 1 because the first bit is
> > set. This code will do: ret = (orig & 0xff) >> 1; I think it should be
> > ret = (orig & 0xff) >> 0;
> >
> > If the mask was 0xff00 I would expect >> 8 instead of >> 9 etc.
>
> ffs(0xff)=1 and __ffs(0xff)=0, so I think original is correct.
Oh, wow. You're right. I hadn't realized it worked like that.
Sorry!
regards,
dan carpenter
next prev parent reply other threads:[~2022-12-13 4:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-12 15:33 [bug report] rtw89: add Realtek 802.11ax driver Dan Carpenter
2022-12-13 0:46 ` Ping-Ke Shih
2022-12-13 4:21 ` Dan Carpenter [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-11-30 10:42 Dan Carpenter
2021-12-01 1:57 ` Pkshih
2021-11-12 7:51 Dan Carpenter
2021-11-15 7:33 ` Pkshih
2021-11-19 6:01 ` Pkshih
2021-11-08 14:47 Dan Carpenter
2021-11-09 1:04 ` Pkshih
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=Y5f9sUhoY/vqy0cQ@kadam \
--to=error27@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=pkshih@realtek.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 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.