From 6b688f5329e560ef432f6ea281b2fe3d905ef297 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Fri, 12 Feb 2021 13:49:11 +0100 Subject: src: use ARRAY_SIZE where possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generated with a variant of https://coccinelle.gitlabpages.inria.fr/website/rules/array.cocci Change-Id: I083704fd48faeb6c67bba3367fbcfe554a9f7c66 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/c/coreboot/+/50594 Reviewed-by: Angel Pons Reviewed-by: HAOUAS Elyes Reviewed-by: Kyösti Mälkki Tested-by: build bot (Jenkins) --- src/soc/intel/braswell/tsc_freq.c | 2 +- src/soc/intel/denverton_ns/gpio_dnv.c | 3 +-- src/soc/qualcomm/sc7180/display/dsi_phy.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/soc') diff --git a/src/soc/intel/braswell/tsc_freq.c b/src/soc/intel/braswell/tsc_freq.c index ae0cce3cae..5c10dd58d0 100644 --- a/src/soc/intel/braswell/tsc_freq.c +++ b/src/soc/intel/braswell/tsc_freq.c @@ -20,7 +20,7 @@ unsigned int cpu_bus_freq_khz(void) { msr_t clk_info = rdmsr(MSR_BSEL_CR_OVERCLOCK_CONTROL); - if ((clk_info.lo & 0xf) < (sizeof(cpu_bus_clk_freq_table) / sizeof(unsigned int))) + if ((clk_info.lo & 0xf) < ARRAY_SIZE(cpu_bus_clk_freq_table)) return cpu_bus_clk_freq_table[clk_info.lo & 0xf]; return 0; diff --git a/src/soc/intel/denverton_ns/gpio_dnv.c b/src/soc/intel/denverton_ns/gpio_dnv.c index 0999cce4cd..70138d3ed7 100644 --- a/src/soc/intel/denverton_ns/gpio_dnv.c +++ b/src/soc/intel/denverton_ns/gpio_dnv.c @@ -59,8 +59,7 @@ static const struct GPIO_GROUP_INFO mGpioGroupInfo[] = { static struct GPIO_GROUP_INFO * GpioGetGroupInfoTable(uint32_t *GpioGroupInfoTableLength) { - *GpioGroupInfoTableLength = - sizeof(mGpioGroupInfo) / sizeof(struct GPIO_GROUP_INFO); + *GpioGroupInfoTableLength = ARRAY_SIZE(mGpioGroupInfo); return (struct GPIO_GROUP_INFO *)mGpioGroupInfo; } diff --git a/src/soc/qualcomm/sc7180/display/dsi_phy.c b/src/soc/qualcomm/sc7180/display/dsi_phy.c index 050a5d88f1..db4b67cfe7 100644 --- a/src/soc/qualcomm/sc7180/display/dsi_phy.c +++ b/src/soc/qualcomm/sc7180/display/dsi_phy.c @@ -564,7 +564,7 @@ static unsigned long dsi_phy_calc_clk_divider(struct dsi_phy_configtype *phy_cfg /* D Phy */ lut = pll_dividerlut_dphy; - lut_max = sizeof(pll_dividerlut_dphy) / sizeof(*lut); + lut_max = ARRAY_SIZE(pll_dividerlut_dphy); lut += (lut_max - 1); /* PLL Post Div - from LUT -- cgit v1.2.3