Commit c75c5075 authored by Corey Minyard's avatar Corey Minyard

ipmi: Don't leave holes in the I2C address list in the ssif driver

The algorithm to populate the I2C address list would leave holes
in the list on duplicates.
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
parent 060e8fb5
...@@ -1739,7 +1739,7 @@ static void free_ssif_clients(void) ...@@ -1739,7 +1739,7 @@ static void free_ssif_clients(void)
static unsigned short *ssif_address_list(void) static unsigned short *ssif_address_list(void)
{ {
struct ssif_addr_info *info; struct ssif_addr_info *info;
unsigned int count = 0, i; unsigned int count = 0, i = 0;
unsigned short *address_list; unsigned short *address_list;
list_for_each_entry(info, &ssif_infos, link) list_for_each_entry(info, &ssif_infos, link)
...@@ -1750,18 +1750,17 @@ static unsigned short *ssif_address_list(void) ...@@ -1750,18 +1750,17 @@ static unsigned short *ssif_address_list(void)
if (!address_list) if (!address_list)
return NULL; return NULL;
i = 0;
list_for_each_entry(info, &ssif_infos, link) { list_for_each_entry(info, &ssif_infos, link) {
unsigned short addr = info->binfo.addr; unsigned short addr = info->binfo.addr;
int j; int j;
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
if (address_list[j] == addr) if (address_list[j] == addr)
goto skip_addr; /* Found a dup. */
break;
} }
address_list[i] = addr; if (j == i) /* Didn't find it in the list. */
skip_addr: address_list[i++] = addr;
i++;
} }
address_list[i] = I2C_CLIENT_END; address_list[i] = I2C_CLIENT_END;
......
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