summaryrefslogtreecommitdiff
path: root/chip/npcx/system.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2019-03-11 16:07:55 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-03-26 04:42:56 -0700
commitac77140b7f4f42075d2377fc9d956a636b05aacf (patch)
treec64c6a30916ff741a2ab235141f7bd071cd54483 /chip/npcx/system.c
parentbb266fc26fc05d4ab22de6ad7bce5b477c9f9140 (diff)
downloadchrome-ec-ac77140b7f4f42075d2377fc9d956a636b05aacf.tar.gz
common: bit change 1 << constants with BIT(constants)
Mechanical replacement of bit operation where operand is a constant. More bit operation exist, but prone to errors. Reveal a bug in npcx: chip/npcx/system-npcx7.c:114:54: error: conversion from 'long unsigned int' to 'uint8_t' {aka 'volatile unsigned char'} changes value from '16777215' to '255' [-Werror=overflow] BUG=None BRANCH=None TEST=None Change-Id: I006614026143fa180702ac0d1cc2ceb1b3c6eeb0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518660 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'chip/npcx/system.c')
-rw-r--r--chip/npcx/system.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/chip/npcx/system.c b/chip/npcx/system.c
index b9d3367d91..4b2f55ddb4 100644
--- a/chip/npcx/system.c
+++ b/chip/npcx/system.c
@@ -117,7 +117,7 @@ static int bbram_valid(enum bbram_data_index index, int bytes)
/* Check BBRAM is valid */
if (IS_BIT_SET(NPCX_BKUP_STS, NPCX_BKUP_STS_IBBR)) {
- NPCX_BKUP_STS = (1 << NPCX_BKUP_STS_IBBR);
+ NPCX_BKUP_STS = BIT(NPCX_BKUP_STS_IBBR);
panic_printf("IBBR set: BBRAM corrupted!\n");
return 0;
}
@@ -693,8 +693,8 @@ void system_pre_init(void)
NPCX_PWDWN_CTL(NPCX_PMC_PWDWN_5) = 0xF8;
pwdwn6 = 0x70 |
- (1 << NPCX_PWDWN_CTL6_ITIM6_PD) |
- (1 << NPCX_PWDWN_CTL6_ITIM4_PD); /* Skip ITIM5_PD */
+ BIT(NPCX_PWDWN_CTL6_ITIM6_PD) |
+ BIT(NPCX_PWDWN_CTL6_ITIM4_PD); /* Skip ITIM5_PD */
#if !defined(CONFIG_HOSTCMD_ESPI)
pwdwn6 |= 1 << NPCX_PWDWN_CTL6_ESPI_PD;
#endif