From ac77140b7f4f42075d2377fc9d956a636b05aacf Mon Sep 17 00:00:00 2001 From: Gwendal Grignou Date: Mon, 11 Mar 2019 16:07:55 -0700 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/1518660 Reviewed-by: Daisuke Nojiri --- common/throttle_ap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/throttle_ap.c') diff --git a/common/throttle_ap.c b/common/throttle_ap.c index 209948a482..d82d5429e5 100644 --- a/common/throttle_ap.c +++ b/common/throttle_ap.c @@ -30,7 +30,7 @@ void throttle_ap(enum throttle_level level, mutex_lock(&throttle_mutex); - bitmask = (1 << source); + bitmask = BIT(source); switch (level) { case THROTTLE_ON: -- cgit v1.2.1