};
static char* cp_name[] = {
+ "INVALID",
"INT_HARDWARE_ENTRY",
"INT_HW_IRQ_EN",
"INT_TASKLET_ENTRY",
};
static char* cp_type[] = {
+ "NONE",
"PANIC",
"BUG",
"WARNING",
for (i = 0; i < ARRAY_SIZE(cp_type); i++) {
if (!strcmp(what, cp_type[i]))
- return i + 1;
+ return i;
}
return CT_NONE;
static const char *cp_type_to_str(enum ctype type)
{
if (type == CT_NONE || type < 0 || type > ARRAY_SIZE(cp_type))
- return "None";
+ return "NONE";
- return cp_type[type - 1];
+ return cp_type[type];
}
static const char *cp_name_to_str(enum cname name)
if (name == CN_INVALID || name < 0 || name > ARRAY_SIZE(cp_name))
return "INVALID";
- return cp_name[name - 1];
+ return cp_name[name];
}
if (cptype == CT_NONE)
return -EINVAL;
+ /* Refuse INVALID as a selectable crashpoint name. */
+ if (!strcmp(cpoint_name, "INVALID"))
+ return -EINVAL;
+
for (i = 0; i < ARRAY_SIZE(cp_name); i++) {
if (!strcmp(cpoint_name, cp_name[i])) {
- cpoint = i + 1;
+ cpoint = i;
return 0;
}
}