ID: 28 - 'lib/ipmi_delloem.c' - clean up the code

ipmi_get_power_consumption_data - simplify - If rsp is NULL or ccode is not 0,
then return immediately.
This commit is contained in:
Zdenek Styblik 2013-07-07 11:47:49 +00:00
parent 5819b314af
commit 5d5251f7da

View File

@ -3064,33 +3064,32 @@ ipmi_get_power_consumption_data(struct ipmi_intf * intf,uint8_t unit)
sdr->record.common->keys.owner_id, sdr->record.common->keys.owner_id,
sdr->record.common->keys.lun, sdr->record.common->keys.lun,
sdr->record.common->keys.channel); sdr->record.common->keys.channel);
if (rsp != NULL && rsp->ccode == 0) { if (rsp == NULL || rsp->ccode != 0) {
readingbtuphr = sdr_convert_sensor_reading(sdr->record.full,
sensorReadingData.sensorReading);
warning_threshbtuphr = sdr_convert_sensor_reading(sdr->record.full,
rsp->data[4]);
failure_threshbtuphr = sdr_convert_sensor_reading(sdr->record.full,
rsp->data[5]);
printf("System Board System Level\n");
if (unit == btuphr) {
readingbtuphr = watt_to_btuphr_conversion(readingbtuphr);
warning_threshbtuphr = watt_to_btuphr_conversion(warning_threshbtuphr);
failure_threshbtuphr = watt_to_btuphr_conversion( failure_threshbtuphr);
printf("Reading : %d BTU/hr\n", readingbtuphr);
printf("Warning threshold : %d BTU/hr\n", warning_threshbtuphr);
printf("Failure threshold : %d BTU/hr\n", failure_threshbtuphr);
} else {
printf("Reading : %d W \n",readingbtuphr);
printf("Warning threshold : %d W \n",(warning_threshbtuphr));
printf("Failure threshold : %d W \n",(failure_threshbtuphr));
}
} else {
lprintf(LOG_ERR, lprintf(LOG_ERR,
"Error : Can not access the System Level sensor data"); "Error : Can not access the System Level sensor data");
return -1; return -1;
} }
readingbtuphr = sdr_convert_sensor_reading(sdr->record.full,
sensorReadingData.sensorReading);
warning_threshbtuphr = sdr_convert_sensor_reading(sdr->record.full,
rsp->data[4]);
failure_threshbtuphr = sdr_convert_sensor_reading(sdr->record.full,
rsp->data[5]);
printf("System Board System Level\n");
if (unit == btuphr) {
readingbtuphr = watt_to_btuphr_conversion(readingbtuphr);
warning_threshbtuphr = watt_to_btuphr_conversion(warning_threshbtuphr);
failure_threshbtuphr = watt_to_btuphr_conversion( failure_threshbtuphr);
printf("Reading : %d BTU/hr\n", readingbtuphr);
printf("Warning threshold : %d BTU/hr\n", warning_threshbtuphr);
printf("Failure threshold : %d BTU/hr\n", failure_threshbtuphr);
} else {
printf("Reading : %d W \n",readingbtuphr);
printf("Warning threshold : %d W \n",(warning_threshbtuphr));
printf("Failure threshold : %d W \n",(failure_threshbtuphr));
}
return status; return status;
} }
/* /*