Attention is currently required from: Patrick Rudolph. Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/52107 )
Change subject: soc/intel: Replace open-coded buffer length calculation ......................................................................
soc/intel: Replace open-coded buffer length calculation
Use `sizeof(value)` instead of manually calculating the buffer size.
Change-Id: Ibe49e40b1c4f2c0b661d94e59059a95bdb204197 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/soc/intel/alderlake/chip.c M src/soc/intel/cannonlake/gpio_common.c M src/soc/intel/elkhartlake/chip.c M src/soc/intel/icelake/chip.c M src/soc/intel/jasperlake/chip.c M src/soc/intel/tigerlake/chip.c 6 files changed, 12 insertions(+), 24 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/07/52107/1
diff --git a/src/soc/intel/alderlake/chip.c b/src/soc/intel/alderlake/chip.c index dc54845..f4d0241 100644 --- a/src/soc/intel/alderlake/chip.c +++ b/src/soc/intel/alderlake/chip.c @@ -116,11 +116,9 @@ const config_t *config = config_of_soc();
if (config->gpio_override_pm) - memcpy(value, config->gpio_pm, sizeof(uint8_t) * - TOTAL_GPIO_COMM); + memcpy(value, config->gpio_pm, sizeof(value)); else - memset(value, MISCCFG_GPIO_PM_CONFIG_BITS, sizeof(uint8_t) * - TOTAL_GPIO_COMM); + memset(value, MISCCFG_GPIO_PM_CONFIG_BITS, sizeof(value));
gpio_pm_configure(value, TOTAL_GPIO_COMM); } diff --git a/src/soc/intel/cannonlake/gpio_common.c b/src/soc/intel/cannonlake/gpio_common.c index 2c2dcdb..4307260 100644 --- a/src/soc/intel/cannonlake/gpio_common.c +++ b/src/soc/intel/cannonlake/gpio_common.c @@ -14,11 +14,9 @@ const config_t *config = config_of_soc();
if (config->gpio_override_pm) - memcpy(value, config->gpio_pm, sizeof(uint8_t) * - TOTAL_GPIO_COMM); + memcpy(value, config->gpio_pm, sizeof(value)); else - memset(value, MISCCFG_GPIO_PM_CONFIG_BITS, sizeof(uint8_t) * - TOTAL_GPIO_COMM); + memset(value, MISCCFG_GPIO_PM_CONFIG_BITS, sizeof(value));
gpio_pm_configure(value, TOTAL_GPIO_COMM); } diff --git a/src/soc/intel/elkhartlake/chip.c b/src/soc/intel/elkhartlake/chip.c index 3917ea0..ad63481 100644 --- a/src/soc/intel/elkhartlake/chip.c +++ b/src/soc/intel/elkhartlake/chip.c @@ -105,11 +105,9 @@ const config_t *config = config_of_soc();
if (config->gpio_override_pm) - memcpy(value, config->gpio_pm, sizeof(uint8_t) * - TOTAL_GPIO_COMM); + memcpy(value, config->gpio_pm, sizeof(value)); else - memset(value, MISCCFG_GPIO_PM_CONFIG_BITS, sizeof(uint8_t) * - TOTAL_GPIO_COMM); + memset(value, MISCCFG_GPIO_PM_CONFIG_BITS, sizeof(value));
gpio_pm_configure(value, TOTAL_GPIO_COMM); } diff --git a/src/soc/intel/icelake/chip.c b/src/soc/intel/icelake/chip.c index 32b1830..05f42b4 100644 --- a/src/soc/intel/icelake/chip.c +++ b/src/soc/intel/icelake/chip.c @@ -95,11 +95,9 @@ const config_t *config = config_of_soc();
if (config->gpio_override_pm) - memcpy(value, config->gpio_pm, sizeof(uint8_t) * - TOTAL_GPIO_COMM); + memcpy(value, config->gpio_pm, sizeof(value)); else - memset(value, MISCCFG_GPIO_PM_CONFIG_BITS, sizeof(uint8_t) * - TOTAL_GPIO_COMM); + memset(value, MISCCFG_GPIO_PM_CONFIG_BITS, sizeof(value));
gpio_pm_configure(value, TOTAL_GPIO_COMM); } diff --git a/src/soc/intel/jasperlake/chip.c b/src/soc/intel/jasperlake/chip.c index ea29fd8..a8e3c88 100644 --- a/src/soc/intel/jasperlake/chip.c +++ b/src/soc/intel/jasperlake/chip.c @@ -111,11 +111,9 @@ const config_t *config = config_of_soc();
if (config->gpio_override_pm) - memcpy(value, config->gpio_pm, sizeof(uint8_t) * - TOTAL_GPIO_COMM); + memcpy(value, config->gpio_pm, sizeof(value)); else - memset(value, MISCCFG_GPIO_PM_CONFIG_BITS, sizeof(uint8_t) * - TOTAL_GPIO_COMM); + memset(value, MISCCFG_GPIO_PM_CONFIG_BITS, sizeof(value));
gpio_pm_configure(value, TOTAL_GPIO_COMM); } diff --git a/src/soc/intel/tigerlake/chip.c b/src/soc/intel/tigerlake/chip.c index 1affcce..eefc408 100644 --- a/src/soc/intel/tigerlake/chip.c +++ b/src/soc/intel/tigerlake/chip.c @@ -116,11 +116,9 @@ const config_t *config = config_of_soc();
if (config->gpio_override_pm) - memcpy(value, config->gpio_pm, sizeof(uint8_t) * - TOTAL_GPIO_COMM); + memcpy(value, config->gpio_pm, sizeof(value)); else - memset(value, MISCCFG_GPIO_PM_CONFIG_BITS, sizeof(uint8_t) * - TOTAL_GPIO_COMM); + memset(value, MISCCFG_GPIO_PM_CONFIG_BITS, sizeof(value));
gpio_pm_configure(value, TOTAL_GPIO_COMM); }