Commit 445b1747 authored by Bernhard Nortmann's avatar Bernhard Nortmann
Browse files

soc_info: Iterate over soc_info_table with pointer, not by index


Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
parent e9c3ff14
...@@ -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;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment