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_get_power_consumption_data - simplify - If rsp is NULL or ccode is not 0, then return immediately.
This commit is contained in:
parent
5819b314af
commit
5d5251f7da
@ -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.lun,
|
||||
sdr->record.common->keys.channel);
|
||||
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 {
|
||||
if (rsp == NULL || rsp->ccode != 0) {
|
||||
lprintf(LOG_ERR,
|
||||
"Error : Can not access the System Level sensor data");
|
||||
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;
|
||||
}
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user