* [U-Boot] [PATCH 0/2] fix flash_get_info function
@ 2013-05-17 5:50 Masahiro Yamada
2013-05-17 5:50 ` [U-Boot] [PATCH 1/2] cosmetic: cfi_flash: delete a space after an unary operator Masahiro Yamada
2013-05-17 5:50 ` [U-Boot] [PATCH 2/2] cfi_flash: return NULL for invalid base address input Masahiro Yamada
0 siblings, 2 replies; 5+ messages in thread
From: Masahiro Yamada @ 2013-05-17 5:50 UTC (permalink / raw)
To: u-boot
These series patch correct the behaviour of
flash_get_info() function defined in drivers/mtd/cfi_flash.c
I separated a cosmetic change in the first patch.
Masahiro Yamada (2):
cosmetic: cfi_flash: delete a space after an unary operator
cfi_flash: return NULL for invalid base address input
drivers/mtd/cfi_flash.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 1/2] cosmetic: cfi_flash: delete a space after an unary operator
2013-05-17 5:50 [U-Boot] [PATCH 0/2] fix flash_get_info function Masahiro Yamada
@ 2013-05-17 5:50 ` Masahiro Yamada
2013-05-23 7:49 ` Stefan Roese
2013-05-17 5:50 ` [U-Boot] [PATCH 2/2] cfi_flash: return NULL for invalid base address input Masahiro Yamada
1 sibling, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2013-05-17 5:50 UTC (permalink / raw)
To: u-boot
Linux Kernel Documentation/CodingStyle says:
Do not add a space after unary operators such as &, *, ...
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---
drivers/mtd/cfi_flash.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 22d8440..6dd47b4 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -186,7 +186,7 @@ flash_info_t *flash_get_info(ulong base)
flash_info_t *info = NULL;
for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) {
- info = & flash_info[i];
+ info = &flash_info[i];
if (info->size && info->start[0] <= base &&
base <= info->start[0] + info->size - 1)
break;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 2/2] cfi_flash: return NULL for invalid base address input
2013-05-17 5:50 [U-Boot] [PATCH 0/2] fix flash_get_info function Masahiro Yamada
2013-05-17 5:50 ` [U-Boot] [PATCH 1/2] cosmetic: cfi_flash: delete a space after an unary operator Masahiro Yamada
@ 2013-05-17 5:50 ` Masahiro Yamada
2013-05-23 7:50 ` Stefan Roese
1 sibling, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2013-05-17 5:50 UTC (permalink / raw)
To: u-boot
When base address given was out of valid flash address ranges,
flash_get_info() function returned the pointer to the last
element of flash_info[i] array.
This patch changes this function to return NULL pointer
in such a case, which is more correct behaviour.
The function flash_protect_default() calls flash_protect()
immediately after flash_get_info() invocation.
With this correction, flash_protect() function would be
able to return soon, for NULL flash_info.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---
drivers/mtd/cfi_flash.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 6dd47b4..ac8318a 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -183,16 +183,16 @@ u64 flash_read64(void *addr)__attribute__((weak, alias("__flash_read64")));
flash_info_t *flash_get_info(ulong base)
{
int i;
- flash_info_t *info = NULL;
+ flash_info_t *info;
for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) {
info = &flash_info[i];
if (info->size && info->start[0] <= base &&
base <= info->start[0] + info->size - 1)
- break;
+ return info;
}
- return info;
+ return NULL;
}
#endif
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 1/2] cosmetic: cfi_flash: delete a space after an unary operator
2013-05-17 5:50 ` [U-Boot] [PATCH 1/2] cosmetic: cfi_flash: delete a space after an unary operator Masahiro Yamada
@ 2013-05-23 7:49 ` Stefan Roese
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Roese @ 2013-05-23 7:49 UTC (permalink / raw)
To: u-boot
On 05/17/2013 07:50 AM, Masahiro Yamada wrote:
> Linux Kernel Documentation/CodingStyle says:
> Do not add a space after unary operators such as &, *, ...
Applied to u-boot-cfi-flash/master.
Thanks,
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 2/2] cfi_flash: return NULL for invalid base address input
2013-05-17 5:50 ` [U-Boot] [PATCH 2/2] cfi_flash: return NULL for invalid base address input Masahiro Yamada
@ 2013-05-23 7:50 ` Stefan Roese
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Roese @ 2013-05-23 7:50 UTC (permalink / raw)
To: u-boot
On 05/17/2013 07:50 AM, Masahiro Yamada wrote:
> When base address given was out of valid flash address ranges,
> flash_get_info() function returned the pointer to the last
> element of flash_info[i] array.
>
> This patch changes this function to return NULL pointer
> in such a case, which is more correct behaviour.
>
> The function flash_protect_default() calls flash_protect()
> immediately after flash_get_info() invocation.
> With this correction, flash_protect() function would be
> able to return soon, for NULL flash_info.
Applied to u-boot-cfi-flash/master.
Thanks,
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-05-23 7:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-17 5:50 [U-Boot] [PATCH 0/2] fix flash_get_info function Masahiro Yamada
2013-05-17 5:50 ` [U-Boot] [PATCH 1/2] cosmetic: cfi_flash: delete a space after an unary operator Masahiro Yamada
2013-05-23 7:49 ` Stefan Roese
2013-05-17 5:50 ` [U-Boot] [PATCH 2/2] cfi_flash: return NULL for invalid base address input Masahiro Yamada
2013-05-23 7:50 ` Stefan Roese
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox