summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
authorJacob Garber <jgarber1@ualberta.ca>2019-07-22 16:20:36 -0600
committerPatrick Georgi <pgeorgi@google.com>2019-07-25 16:06:12 +0000
commit0f33d8c29aadce21b02d0376547441b6f38dcede (patch)
tree3b42c107232f1c439b0660fbaa01e13bad8a3e9a /src/soc
parent877481cda24aa179da5ea1ad437198d4df26dec1 (diff)
downloadcoreboot-0f33d8c29aadce21b02d0376547441b6f38dcede.tar.xz
soc/qualcomm/ipq806x: Remove unnecessary allocation
The bus variable doesn't live outside the scope of this function, and is only used as a convenient way for passing the pointers to all the sub-functions, so it doesn't need to be allocated. Put it on the stack instead. Change-Id: I4370d77445952731d20f7d9a91803612f4d21aef Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Found-by: Coverity CID 1294801 Reviewed-on: https://review.coreboot.org/c/coreboot/+/34499 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/qualcomm/ipq806x/lcc.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/soc/qualcomm/ipq806x/lcc.c b/src/soc/qualcomm/ipq806x/lcc.c
index 68b878ceab..8f862b4d49 100644
--- a/src/soc/qualcomm/ipq806x/lcc.c
+++ b/src/soc/qualcomm/ipq806x/lcc.c
@@ -287,29 +287,21 @@ static int lcc_enable_mi2s(Ipq806xLccClocks *bus)
int audio_clock_config(unsigned frequency)
{
- Ipq806xLccClocks *bus = malloc(sizeof(*bus));
-
- if (!bus) {
- printk(BIOS_ERR, "%s: failed to allocate bus structure\n",
- __func__);
+ Ipq806xLccClocks bus = {
+ .gcc_apcs_regs = (void *)(MSM_GCC_BASE + GCC_PLL_APCS_REG),
+ .lcc_pll0_regs = (void *)(MSM_LPASS_LCC_BASE + LCC_PLL0_MODE_REG),
+ .lcc_ahbix_regs = (void *)(MSM_LPASS_LCC_BASE + LCC_AHBIX_NS_REG),
+ .lcc_mi2s_regs = (void *)(MSM_LPASS_LCC_BASE + LCC_MI2S_NS_REG),
+ .lcc_pll_regs = (void *)(MSM_LPASS_LCC_BASE + LCC_PLL_PCLK_REG),
+ };
+
+ if (lcc_init_enable_pll0(&bus))
return 1;
- }
-
- bus->gcc_apcs_regs = (void *)(MSM_GCC_BASE + GCC_PLL_APCS_REG);
- bus->lcc_pll0_regs = (void *)(MSM_LPASS_LCC_BASE + LCC_PLL0_MODE_REG);
- bus->lcc_ahbix_regs = (void *)(MSM_LPASS_LCC_BASE + LCC_AHBIX_NS_REG);
- bus->lcc_mi2s_regs = (void *)(MSM_LPASS_LCC_BASE + LCC_MI2S_NS_REG);
- bus->lcc_pll_regs = (void *)(MSM_LPASS_LCC_BASE + LCC_PLL_PCLK_REG);
-
-
- if (lcc_init_enable_pll0(bus))
- return 1;
- if (lcc_init_enable_ahbix(bus))
+ if (lcc_init_enable_ahbix(&bus))
return 1;
- if (lcc_init_mi2s(bus, frequency))
+ if (lcc_init_mi2s(&bus, frequency))
return 1;
-
- if (lcc_enable_mi2s(bus))
+ if (lcc_enable_mi2s(&bus))
return 1;
return 0;