mirror of
https://github.com/ipmitool/ipmitool.git
synced 2026-06-29 16:51:35 +00:00
Refactoring: optimize pointer checks
Remove all direct comparisons to 'NULL' for pointers. Replace them with boolean-like 'if (ptr)' and 'if (!ptr)'. This makes conditions shorter and easier to read. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
@@ -1632,7 +1632,7 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
|
||||
req.msg.data_len = 1;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (rsp == NULL) {
|
||||
if (!rsp) {
|
||||
printf(" Device not present (No Response)\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -1656,7 +1656,7 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
|
||||
|
||||
spd_data = malloc(fru.size);
|
||||
|
||||
if (spd_data == NULL) {
|
||||
if (!spd_data) {
|
||||
printf(" Unable to malloc memory for spd array of size=%d\n",
|
||||
fru.size);
|
||||
return -1;
|
||||
@@ -1677,7 +1677,7 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
|
||||
msg_data[3] = FRU_DATA_RQST_SIZE;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (rsp == NULL) {
|
||||
if (!rsp) {
|
||||
printf(" Device not present (No Response)\n");
|
||||
free(spd_data);
|
||||
spd_data = NULL;
|
||||
|
||||
Reference in New Issue
Block a user