]> Git Repo - linux.git/commitdiff
staging: gpib: Fix inadvertent negative shift
authorDave Penkler <[email protected]>
Thu, 16 Jan 2025 11:00:14 +0000 (12:00 +0100)
committerGreg Kroah-Hartman <[email protected]>
Thu, 16 Jan 2025 12:23:35 +0000 (13:23 +0100)
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/staging/gpib/include/amcc5920.h

index 766b3799223f14c12325ee86f0f555ed0bbd43be..7a88bd282feb517d5a5513280549d26386cb4b40 100644 (file)
@@ -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);
 };
 
 enum amcc_prefetch_bits {
This page took 0.058501 seconds and 4 git commands to generate.