Merge pull request #58 from wanghaibin-mouse/master

Fix compile warning and spell error
This commit is contained in:
Neil Horman 2017-08-29 07:18:08 -04:00 committed by GitHub
commit aae4eb617d
2 changed files with 23 additions and 16 deletions

View file

@ -57,7 +57,17 @@ static int check_platform_device(char *name, struct irq_info *info)
DIR *dirfd;
char path[512];
struct dirent *ent;
int rc = -ENOENT;
int rc = -ENOENT, i;
static struct pdev_irq_info {
char *d_name;
int type;
int class;
} pdev_irq_info[] = {
{"ata", IRQ_TYPE_LEGACY, IRQ_SCSI},
{"net", IRQ_TYPE_LEGACY, IRQ_ETH},
{"usb", IRQ_TYPE_LEGACY, IRQ_OTHER},
{NULL},
};
memset(path, 0, 512);
@ -74,21 +84,13 @@ static int check_platform_device(char *name, struct irq_info *info)
while ((ent = readdir(dirfd)) != NULL) {
log(TO_ALL, LOG_DEBUG, "Checking entry %s\n", ent->d_name);
if (!strncmp(ent->d_name, "ata", strlen("ata"))) {
info->type = IRQ_TYPE_LEGACY;
info->class = IRQ_SCSI;
rc = 0;
goto out;
} else if (!strncmp(ent->d_name, "net", strlen("net"))) {
info->type = IRQ_TYPE_LEGACY;
info->class = IRQ_ETH;
rc = 0;
goto out;
} else if (!strncmp(ent->d_name, "usb", strlen("net"))) {
info->type = IRQ_TYPE_LEGACY;
info->class = IRQ_OTHER;
rc = 0;
goto out;
for (i = 0; pdev_irq_info[i].d_name != NULL; i++) {
if (!strncmp(ent->d_name, pdev_irq_info[i].d_name, strlen(pdev_irq_info[i].d_name))) {
info->type = pdev_irq_info[i].type;
info->class = pdev_irq_info[i].class;
rc = 0;
goto out;
}
}
}

View file

@ -125,6 +125,8 @@ void parse_setup(char *setup_data)
char *copy;
if((setup_data == NULL) || (strlen(setup_data) == 0)) return;
copy = strdup(setup_data);
if (!copy)
return;
setup.banned_irqs = NULL;
setup.banned_cpus = NULL;
@ -243,6 +245,9 @@ void parse_into_tree(char *data)
return;
copy = strdup(data);
if (!copy)
return;
token = strtok_r(copy, " ", &ptr);
while(token != NULL) {
/* Parse node data */