ID: 3522731 - 'lib/ipmi_sol.c' - ipmi_get_sol_info() returns always 0

Commit fixes ipmi_get_sol_info()'s return value, so (-1) is returned on error,
eg. response is NULL. It doesn't matter whether it is first or last response, we
bail out immediately.
Commit also fixes missing argument to one lprintf() and
indentation(spaces->tabs).

This bug is connected with ``ID: 1835038 - 'lib/ipmi_sol.c' -
ipmi_get_sol_info() returns always 0''.

Reported by: Duncan Idaho
This commit is contained in:
Zdenek Styblik 2012-10-21 11:46:17 +00:00
parent 8d828f6c72
commit f8f6d51fd2

View File

@ -208,7 +208,6 @@ ipmi_get_sol_info(
req.msg.data_len = 4;
req.msg.data = data;
/*
* set in progress
*/
@ -219,6 +218,11 @@ ipmi_get_sol_info(
data[3] = 0x00; /* block selector */
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
return (-1);
}
if (NULL != rsp) {
switch (rsp->ccode) {
@ -242,9 +246,6 @@ ipmi_get_sol_info(
val2str(rsp->ccode, completion_code_vals));
return -1;
}
} else {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
}
/*
@ -257,6 +258,11 @@ ipmi_get_sol_info(
data[3] = 0x00; /* block selector */
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
return (-1);
}
if (NULL != rsp) {
switch (rsp->ccode) {
@ -280,9 +286,6 @@ ipmi_get_sol_info(
val2str(rsp->ccode, completion_code_vals));
return -1;
}
} else {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
}
/*
@ -295,6 +298,12 @@ ipmi_get_sol_info(
data[3] = 0x00; /* block selector */
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
return (-1);
}
if (NULL != rsp) {
switch (rsp->ccode) {
case 0x00:
@ -319,9 +328,6 @@ ipmi_get_sol_info(
val2str(rsp->ccode, completion_code_vals));
return -1;
}
} else {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
}
/*
@ -334,6 +340,12 @@ ipmi_get_sol_info(
data[3] = 0x00; /* block selector */
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
return (-1);
}
if (NULL != rsp) {
switch (rsp->ccode) {
case 0x00:
@ -357,9 +369,6 @@ ipmi_get_sol_info(
val2str(rsp->ccode, completion_code_vals));
return -1;
}
} else {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
}
/*
@ -372,6 +381,12 @@ ipmi_get_sol_info(
data[3] = 0x00; /* block selector */
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
return (-1);
}
if (NULL != rsp) {
switch (rsp->ccode) {
case 0x00:
@ -395,9 +410,6 @@ ipmi_get_sol_info(
val2str(rsp->ccode, completion_code_vals));
return -1;
}
} else {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
}
/*
@ -410,6 +422,12 @@ ipmi_get_sol_info(
data[3] = 0x00; /* block selector */
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
return (-1);
}
if (NULL != rsp) {
switch (rsp->ccode) {
case 0x00:
@ -432,9 +450,6 @@ ipmi_get_sol_info(
val2str(rsp->ccode, completion_code_vals));
return -1;
}
} else {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
}
/*
@ -447,6 +462,12 @@ ipmi_get_sol_info(
data[3] = 0x00; /* block selector */
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
return (-1);
}
if (NULL != rsp) {
switch (rsp->ccode) {
case 0x00:
@ -469,9 +490,6 @@ ipmi_get_sol_info(
val2str(rsp->ccode, completion_code_vals));
return -1;
}
} else {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
}
/*
@ -484,6 +502,12 @@ ipmi_get_sol_info(
data[3] = 0x00; /* block selector */
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
return (-1);
}
if (NULL != rsp) {
switch (rsp->ccode) {
case 0x00:
@ -507,9 +531,6 @@ ipmi_get_sol_info(
val2str(rsp->ccode, completion_code_vals));
return -1;
}
} else {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
}
/*
@ -522,6 +543,12 @@ ipmi_get_sol_info(
data[3] = 0x00; /* block selector */
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
return (-1);
}
if (NULL != rsp) {
switch (rsp->ccode) {
case 0x00:
@ -535,11 +562,15 @@ ipmi_get_sol_info(
}
break;
case 0x80:
if( intf->session != NULL ){
lprintf(LOG_ERR, "Info: SOL parameter '%s' not supported - defaulting to %d", val2str(data[1], sol_parameter_vals), intf->session->port);
if( intf->session != NULL ) {
lprintf(LOG_ERR, "Info: SOL parameter '%s' not supported - defaulting to %d",
val2str(data[1], sol_parameter_vals), intf->session->port);
params->payload_port = intf->session->port;
} else {
lprintf(LOG_ERR, "Info: SOL parameter '%s' not supported - can't determine which payload port to use on NULL session" );
lprintf(LOG_ERR,
"Info: SOL parameter '%s' not supported - can't determine which "
"payload port to use on NULL session",
val2str(data[1], sol_parameter_vals));
return -1;
}
break;
@ -549,9 +580,6 @@ ipmi_get_sol_info(
val2str(rsp->ccode, completion_code_vals));
return -1;
}
} else {
lprintf(LOG_ERR, "Error: No response requesting SOL parameter '%s'",
val2str(data[1], sol_parameter_vals));
}
return 0;