Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
445b1747
Commit
445b1747
authored
Dec 01, 2016
by
Bernhard Nortmann
Browse files
soc_info: Iterate over soc_info_table with pointer, not by index
Signed-off-by:
Bernhard Nortmann
<
bernhard.nortmann@web.de
>
parent
e9c3ff14
Changes
1
Show whitespace changes
Inline
Side-by-side
soc_info.c
View file @
445b1747
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <unistd.h>
/*
/*
* The FEL code from BROM in A10/A13/A20 sets up two stacks for itself. One
* The FEL code from BROM in A10/A13/A20 sets up two stacks for itself. One
...
@@ -217,12 +216,11 @@ soc_info_t generic_soc_info = {
...
@@ -217,12 +216,11 @@ soc_info_t generic_soc_info = {
soc_info_t
*
get_soc_info_from_id
(
uint32_t
soc_id
)
soc_info_t
*
get_soc_info_from_id
(
uint32_t
soc_id
)
{
{
soc_info_t
*
result
=
NULL
;
soc_info_t
*
soc
,
*
result
=
NULL
;
int
i
;
for
(
i
=
0
;
soc_info_table
[
i
].
swap_buffers
;
i
++
)
for
(
soc
=
soc_info_table
;
soc
->
swap_buffers
;
soc
++
)
if
(
soc
_info_table
[
i
].
soc_id
==
soc_id
)
{
if
(
soc
->
soc_id
==
soc_id
)
{
result
=
&
soc
_info_table
[
i
]
;
result
=
soc
;
break
;
break
;
}
}
...
@@ -241,12 +239,10 @@ soc_info_t *get_soc_info_from_version(struct aw_fel_version *buf)
...
@@ -241,12 +239,10 @@ soc_info_t *get_soc_info_from_version(struct aw_fel_version *buf)
void
get_soc_name_from_id
(
soc_name_t
buffer
,
uint32_t
soc_id
)
void
get_soc_name_from_id
(
soc_name_t
buffer
,
uint32_t
soc_id
)
{
{
int
i
;
soc_info_t
*
soc
;
for
(
i
=
0
;
soc_info_table
[
i
].
swap_buffers
;
i
++
)
for
(
soc
=
soc_info_table
;
soc
->
swap_buffers
;
soc
++
)
if
(
soc_info_table
[
i
].
soc_id
==
soc_id
if
(
soc
->
soc_id
==
soc_id
&&
soc
->
name
!=
NULL
)
{
&&
soc_info_table
[
i
].
name
!=
NULL
)
{
strncpy
(
buffer
,
soc
->
name
,
sizeof
(
soc_name_t
)
-
1
);
strncpy
(
buffer
,
soc_info_table
[
i
].
name
,
sizeof
(
soc_name_t
)
-
1
);
return
;
return
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment