drivers/spi/spi_flash.c: Prefer 'if' over '#if"

Change preprocessor #if to a regular if and let the compiler optimize
away the unused branch.

Signed-off-by: Fred Reitberger <reitbergerfred@gmail.com>
Change-Id: I7af747812a448064ac6b38686b8bd616a755932e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/73970
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
This commit is contained in:
Fred Reitberger 2023-03-23 14:35:39 -04:00 committed by Lean Sheng Tan
parent 13ed70f10b
commit 3b5d9ee516
1 changed files with 9 additions and 8 deletions

View File

@ -262,14 +262,15 @@ int spi_flash_cmd_erase(const struct spi_flash *flash, u32 offset, size_t len)
spi_flash_addr(offset, cmd);
offset += erase_size;
#if CONFIG(DEBUG_SPI_FLASH)
if (ADDR_MOD)
printk(BIOS_SPEW, "SF: erase %2x %2x %2x %2x %2x (%x)\n",
cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], offset);
else
printk(BIOS_SPEW, "SF: erase %2x %2x %2x %2x (%x)\n",
cmd[0], cmd[1], cmd[2], cmd[3], offset);
#endif
if (CONFIG(DEBUG_SPI_FLASH)) {
if (ADDR_MOD)
printk(BIOS_SPEW, "SF: erase %2x %2x %2x %2x %2x (%x)\n",
cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], offset);
else
printk(BIOS_SPEW, "SF: erase %2x %2x %2x %2x (%x)\n",
cmd[0], cmd[1], cmd[2], cmd[3], offset);
}
ret = spi_flash_cmd(&flash->spi, CMD_WRITE_ENABLE, NULL, 0);
if (ret)
goto out;