mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 10:37:22 +00:00
ID: 28 - 'lib/ipmi_delloem.c' - clean up the code
ipmi_lcd_get_info - simplify - Remove pointless ``if () { } else { }'' and return immediately on error.
This commit is contained in:
parent
516fe51505
commit
eb65a625a2
@ -975,41 +975,40 @@ ipmi_lcd_get_info(struct ipmi_intf * intf)
|
||||
|
||||
if (ipmi_lcd_get_configure_command(intf, &command) != 0) {
|
||||
return -1;
|
||||
} else {
|
||||
if (command == IPMI_DELL_LCD_CONFIG_DEFAULT) {
|
||||
memset(lcdstring,0,IPMI_DELL_LCD_STRING_LENGTH_MAX+1);
|
||||
if (ipmi_lcd_get_platform_model_name(intf, lcdstring,
|
||||
IPMI_DELL_LCD_STRING_LENGTH_MAX,
|
||||
IPMI_DELL_PLATFORM_MODEL_NAME_SELECTOR) != 0) {
|
||||
return (-1);
|
||||
}
|
||||
printf(" Setting: default\n");
|
||||
printf(" Line 1: %s\n", lcdstring);
|
||||
} else if (command == IPMI_DELL_LCD_CONFIG_NONE) {
|
||||
printf(" Setting: none\n");
|
||||
} else if (command == IPMI_DELL_LCD_CONFIG_USER_DEFINED) {
|
||||
printf(" Setting: custom\n");
|
||||
rc = ipmi_mc_getsysinfo(intf, IPMI_DELL_LCD_GET_CAPS_SELECTOR, 0, 0,
|
||||
sizeof(lcd_caps), &lcd_caps);
|
||||
if (rc < 0) {
|
||||
lprintf(LOG_ERR, "Error getting LCD capabilities.");
|
||||
return -1;
|
||||
} else if ((rc == 0xc1) || (rc == 0xcb)) {
|
||||
lprintf(LOG_ERR, "Error getting LCD capabilities: "
|
||||
"Command not supported on this system.");
|
||||
} else if (rc > 0) {
|
||||
lprintf(LOG_ERR, "Error getting LCD capabilities: %s",
|
||||
val2str(rc, completion_code_vals));
|
||||
return -1;
|
||||
}
|
||||
if (lcd_caps.number_lines > 0) {
|
||||
memset(lcdstring, 0, IPMI_DELL_LCD_STRING_LENGTH_MAX + 1);
|
||||
rc = ipmi_lcd_get_single_line_text(intf, lcdstring,
|
||||
lcd_caps.max_chars[0]);
|
||||
printf(" Text: %s\n", lcdstring);
|
||||
} else {
|
||||
printf(" No lines to show\n");
|
||||
}
|
||||
}
|
||||
if (command == IPMI_DELL_LCD_CONFIG_DEFAULT) {
|
||||
memset(lcdstring,0,IPMI_DELL_LCD_STRING_LENGTH_MAX+1);
|
||||
if (ipmi_lcd_get_platform_model_name(intf, lcdstring,
|
||||
IPMI_DELL_LCD_STRING_LENGTH_MAX,
|
||||
IPMI_DELL_PLATFORM_MODEL_NAME_SELECTOR) != 0) {
|
||||
return (-1);
|
||||
}
|
||||
printf(" Setting: default\n");
|
||||
printf(" Line 1: %s\n", lcdstring);
|
||||
} else if (command == IPMI_DELL_LCD_CONFIG_NONE) {
|
||||
printf(" Setting: none\n");
|
||||
} else if (command == IPMI_DELL_LCD_CONFIG_USER_DEFINED) {
|
||||
printf(" Setting: custom\n");
|
||||
rc = ipmi_mc_getsysinfo(intf, IPMI_DELL_LCD_GET_CAPS_SELECTOR, 0, 0,
|
||||
sizeof(lcd_caps), &lcd_caps);
|
||||
if (rc < 0) {
|
||||
lprintf(LOG_ERR, "Error getting LCD capabilities.");
|
||||
return -1;
|
||||
} else if ((rc == 0xc1) || (rc == 0xcb)) {
|
||||
lprintf(LOG_ERR, "Error getting LCD capabilities: "
|
||||
"Command not supported on this system.");
|
||||
} else if (rc > 0) {
|
||||
lprintf(LOG_ERR, "Error getting LCD capabilities: %s",
|
||||
val2str(rc, completion_code_vals));
|
||||
return -1;
|
||||
}
|
||||
if (lcd_caps.number_lines > 0) {
|
||||
memset(lcdstring, 0, IPMI_DELL_LCD_STRING_LENGTH_MAX + 1);
|
||||
rc = ipmi_lcd_get_single_line_text(intf, lcdstring,
|
||||
lcd_caps.max_chars[0]);
|
||||
printf(" Text: %s\n", lcdstring);
|
||||
} else {
|
||||
printf(" No lines to show\n");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user