From: David Laight <david.laight.linux@gmail.com>
To: Dave Penkler <dpenkler@gmail.com>
Cc: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: gpib: Fix inadvertent negative shift
Date: Thu, 16 Jan 2025 22:40:03 +0000 [thread overview]
Message-ID: <20250116224003.28675481@pumpkin> (raw)
In-Reply-To: <20250116110014.15577-1-dpenkler@gmail.com>
On Thu, 16 Jan 2025 12:00:14 +0100
Dave Penkler <dpenkler@gmail.com> wrote:
> During the initial checkpatch cleanup, when removing blanks
> after open parentheses, a minus sign in the argument of a shift
> operation was deleted by mistake. This transformed a pre-decrement
> operation into a negation.
>
> The result of a negative shift is undefined and a warning was
> signalled by sparse.
>
> Restore the pre-decrement operation.
>
> Fixes: 6c52d5e3cde2 ("staging: gpib: Add common include files for GPIB drivers")
> Signed-off-by: Dave Penkler <dpenkler@gmail.com>
> ---
> drivers/staging/gpib/include/amcc5920.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/gpib/include/amcc5920.h b/drivers/staging/gpib/include/amcc5920.h
> index 766b3799223f..7a88bd282feb 100644
> --- a/drivers/staging/gpib/include/amcc5920.h
> +++ b/drivers/staging/gpib/include/amcc5920.h
> @@ -22,7 +22,7 @@ static const int bits_per_region = 8;
>
> static inline uint32_t amcc_wait_state_bits(unsigned int region, unsigned int num_wait_states)
> {
> - return (num_wait_states & 0x7) << (-region * bits_per_region);
> + return (num_wait_states & 0x7) << (--region * bits_per_region);
It would be much better to use (region - 1).
David
> };
>
> enum amcc_prefetch_bits {
next prev parent reply other threads:[~2025-01-16 22:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-16 11:00 [PATCH] staging: gpib: Fix inadvertent negative shift Dave Penkler
2025-01-16 22:40 ` David Laight [this message]
2025-01-17 17:55 ` Dave Penkler
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=20250116224003.28675481@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=dpenkler@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/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.