diff mbox

[U-Boot,2/5] sandbox/fs: Make linking of nodes in os_dirent_ls more obvious

Message ID 9b2bb75d6ec64abeb5dd9d66d4448a66@rwthex-w2-b.rwth-ad.de
State Accepted
Commit ce2ec19c56d646656e64a4b8e0279820337f089e
Delegated to: Simon Glass
Headers show

Commit Message

Stefan Brüns Oct. 1, 2016, 6:41 p.m. UTC
Previously, after reading/creating the second dirent, the second entry
would be chained to the first entry and the first entry would be linked
to head. Instead, immediately link the first entry to head.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
---
 arch/sandbox/cpu/os.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Glass Oct. 3, 2016, 9:49 p.m. UTC | #1
On 1 October 2016 at 12:41, Stefan Brüns <stefan.bruens@rwth-aachen.de> wrote:
> Previously, after reading/creating the second dirent, the second entry
> would be chained to the first entry and the first entry would be linked
> to head. Instead, immediately link the first entry to head.
>
> Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
> ---
>  arch/sandbox/cpu/os.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass Oct. 11, 2016, 12:29 a.m. UTC | #2
On 3 October 2016 at 15:49, Simon Glass <sjg@chromium.org> wrote:
> On 1 October 2016 at 12:41, Stefan Brüns <stefan.bruens@rwth-aachen.de> wrote:
>> Previously, after reading/creating the second dirent, the second entry
>> would be chained to the first entry and the first entry would be linked
>> to head. Instead, immediately link the first entry to head.
>>
>> Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
>> ---
>>  arch/sandbox/cpu/os.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
diff mbox

Patch

diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 2d63dd8..c71882a 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -363,8 +363,8 @@  int os_dirent_ls(const char *dirname, struct os_dirent_node **headp)
 			next->size = buf.st_size;
 		if (node)
 			node->next = next;
-		if (!head)
-			head = node;
+		else
+			head = next;
 	}
 	*headp = head;