From cba34aafde5f50e61d242f86bd4d214207ec7ca7 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Mon, 30 Aug 2010 11:14:38 +0200 Subject: [PATCH] cfi_flash: Simplify flash_get_info() This patch removes an unecessary check in the return statement. This is not needed, since "info" is initializes to NULL. And "info" will not be written to again, if the flash address is not found. Additionally "info" is not initialized to "0" but to "NULL". Signed-off-by: Stefan Roese --- drivers/mtd/cfi_flash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 44ebb9d06a..b4a09dc1c2 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -153,7 +153,7 @@ u64 flash_read64(void *addr)__attribute__((weak, alias("__flash_read64"))); flash_info_t *flash_get_info(ulong base) { int i; - flash_info_t * info = 0; + flash_info_t *info = NULL; for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) { info = & flash_info[i]; @@ -162,7 +162,7 @@ flash_info_t *flash_get_info(ulong base) break; } - return i == CONFIG_SYS_MAX_FLASH_BANKS ? 0 : info; + return info; } #endif -- 2.39.5