Skip to content

Commit 0204081

Browse files
Ray Juiwsakernel
authored andcommitted
i2c: iproc: Fix shifting 31 bits
Fix undefined behaviour in the iProc I2C driver by using 'BIT' marcro. Reported-by: Wolfram Sang <wsa@kernel.org> Signed-off-by: Ray Jui <ray.jui@broadcom.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com> [wsa: in commit msg, don't say 'checkpatch' but name the issue] Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 914a7b3 commit 0204081

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/i2c/busses/i2c-bcm-iproc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ static int bcm_iproc_i2c_xfer_internal(struct bcm_iproc_i2c_dev *iproc_i2c,
720720

721721
/* mark the last byte */
722722
if (!process_call && (i == msg->len - 1))
723-
val |= 1 << M_TX_WR_STATUS_SHIFT;
723+
val |= BIT(M_TX_WR_STATUS_SHIFT);
724724

725725
iproc_i2c_wr_reg(iproc_i2c, M_TX_OFFSET, val);
726726
}
@@ -738,7 +738,7 @@ static int bcm_iproc_i2c_xfer_internal(struct bcm_iproc_i2c_dev *iproc_i2c,
738738
*/
739739
addr = i2c_8bit_addr_from_msg(msg);
740740
/* mark it the last byte out */
741-
val = addr | (1 << M_TX_WR_STATUS_SHIFT);
741+
val = addr | BIT(M_TX_WR_STATUS_SHIFT);
742742
iproc_i2c_wr_reg(iproc_i2c, M_TX_OFFSET, val);
743743
}
744744

0 commit comments

Comments
 (0)