From: "Michał Pecio" <michal.pecio@gmail.com>
To: Niklas Neronin <niklas.neronin@linux.intel.com>
Cc: mathias.nyman@linux.intel.com, linux-usb@vger.kernel.org
Subject: Re: [PATCH v3 1/2] usb: xhci: correct debug message page size calculation
Date: Wed, 5 Mar 2025 09:32:48 +0100 [thread overview]
Message-ID: <20250305093248.3cc6c066@foxbook> (raw)
In-Reply-To: <20250204124145.3998098-2-niklas.neronin@linux.intel.com>
On Tue, 4 Feb 2025 14:41:43 +0200, Niklas Neronin wrote:
> The ffs() function returns the index of the first set bit, starting
> from 1. If no bits are set, it returns zero. This behavior causes an
> off-by-one page size in the debug message, as the page size
> calculation [1] is zero-based, while ffs() is one-based.
>
> Fix this by subtracting one from the result of ffs(). Note that since
> variable 'val' is unsigned, subtracting one from zero will result in
> the maximum unsigned integer value. Consequently, the condition 'if
> (val < 16)' will still function correctly.
>
> [1], Page size: (2^(n+12)), where 'n' is the set page size bit.
>
> Fixes: 81720ec5320c ("usb: host: xhci: use ffs() in xhci_mem_init()")
> Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
Actually, is it useful to fix this code if the next patch in the series
removes it completely?
I thought that you perhaps meant this simple fix to go to stable, but
it isn't marked as such.
Regards,
Michal
next prev parent reply other threads:[~2025-03-05 8:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-04 12:41 [PATCH v3 0/2] usb: xhci: page size improvements Niklas Neronin
2025-02-04 12:41 ` [PATCH v3 1/2] usb: xhci: correct debug message page size calculation Niklas Neronin
2025-03-05 8:32 ` Michał Pecio [this message]
2025-02-04 12:41 ` [PATCH v3 2/2] usb: xhci: set page size to the xHCI-supported size Niklas Neronin
2025-02-04 16:06 ` Mathias Nyman
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=20250305093248.3cc6c066@foxbook \
--to=michal.pecio@gmail.com \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=niklas.neronin@linux.intel.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.