ID: 3603419 - 'lib/ipmi_dcmi.c' - waste of resources

Commit moves one #ifdef upwards in the code, so resources are not wasted
pointlessly. There is no need to allocate memory for variables/structs and open
interface, if we're about to quit immediately because LAN+ support is not
enabled.
Error message got changed as well and it gets printed on STDERR where it
belongs!
This commit is contained in:
Zdenek Styblik 2013-03-08 06:39:54 +00:00
parent db56cc3f86
commit 39ad0d62cc

View File

@ -445,6 +445,11 @@ void display_capabilities_attributes(
static int
ipmi_dcmi_prnt_oobDiscover(struct ipmi_intf * intf)
{
# ifndef IPMI_INTF_LANPLUS
lprintf(LOG_ERR,
"DCMI Discovery is available only when LANplus(IPMI v2.0) is enabled.");
return (-1);
# else
int rc;
if (intf->opened == 0 && intf->open != NULL) {
@ -452,11 +457,6 @@ ipmi_dcmi_prnt_oobDiscover(struct ipmi_intf * intf)
return (int) NULL;
}
#ifndef IPMI_INTF_LANPLUS
printf("Function oobDicover unavailable when lanplus (IPMI v2) is not enabled\n");
return -1;
#else
struct ipmi_session *s;
@ -520,7 +520,7 @@ ipmi_dcmi_prnt_oobDiscover(struct ipmi_intf * intf)
//Lets ping/pong
return ipmiv2_lan_ping(intf);
#endif
# endif
}
/*******************************************************************************
* This is the get DCMI Capabilities function to see what the BMC supports. *