summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorCorey Minyard <cminyard@mvista.com>2018-08-30 13:14:59 -0500
committerCorey Minyard <cminyard@mvista.com>2018-09-18 16:15:33 -0500
commitc75c5075e5c6c686dde62058d3a95984d22cfb11 (patch)
tree3605b85ed1c6ef36267b6f783c2000fa9962044e /drivers/char
parent060e8fb53fe3455568982d10ab8c3dd605565049 (diff)
downloadlinux-c75c5075e5c6c686dde62058d3a95984d22cfb11.tar.bz2
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: Corey Minyard <cminyard@mvista.com>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/ipmi/ipmi_ssif.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index 61bc493765b9..09dcfdd66ed5 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1739,7 +1739,7 @@ static void free_ssif_clients(void)
static unsigned short *ssif_address_list(void)
{
struct ssif_addr_info *info;
- unsigned int count = 0, i;
+ unsigned int count = 0, i = 0;
unsigned short *address_list;
list_for_each_entry(info, &ssif_infos, link)
@@ -1750,18 +1750,17 @@ static unsigned short *ssif_address_list(void)
if (!address_list)
return NULL;
- i = 0;
list_for_each_entry(info, &ssif_infos, link) {
unsigned short addr = info->binfo.addr;
int j;
for (j = 0; j < i; j++) {
if (address_list[j] == addr)
- goto skip_addr;
+ /* Found a dup. */
+ break;
}
- address_list[i] = addr;
-skip_addr:
- i++;
+ if (j == i) /* Didn't find it in the list. */
+ address_list[i++] = addr;
}
address_list[i] = I2C_CLIENT_END;