summaryrefslogtreecommitdiff
path: root/lib/ipmi_channel.c
diff options
context:
space:
mode:
authorAlexander Amelkin <alexander@amelkin.msk.ru>2018-08-21 17:16:19 +0300
committerAlexander Amelkin <alexander@amelkin.msk.ru>2018-08-21 17:30:25 +0300
commite9716e216d970b2c84eff5bde5802a05c202cacb (patch)
tree9e6d868ac902db4ccc3b9a667faad16a50189c27 /lib/ipmi_channel.c
parentf3ef88724f4fb16bc6854e8e850acc2a2145e659 (diff)
downloadipmitool-e9716e216d970b2c84eff5bde5802a05c202cacb.tar.gz
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>
Diffstat (limited to 'lib/ipmi_channel.c')
-rw-r--r--lib/ipmi_channel.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/ipmi_channel.c b/lib/ipmi_channel.c
index 74e49bb..57aebef 100644
--- a/lib/ipmi_channel.c
+++ b/lib/ipmi_channel.c
@@ -75,7 +75,7 @@ _ipmi_get_channel_access(struct ipmi_intf *intf,
struct ipmi_rq req = {0};
uint8_t data[2];
- if (channel_access == NULL) {
+ if (!channel_access) {
return (-3);
}
data[0] = channel_access->channel & 0x0F;
@@ -87,7 +87,7 @@ _ipmi_get_channel_access(struct ipmi_intf *intf,
req.msg.data_len = 2;
rsp = intf->sendrecv(intf, &req);
- if (rsp == NULL) {
+ if (!rsp) {
return (-1);
} else if (rsp->ccode) {
return rsp->ccode;
@@ -118,7 +118,7 @@ _ipmi_get_channel_info(struct ipmi_intf *intf,
struct ipmi_rq req = {0};
uint8_t data[1];
- if (channel_info == NULL) {
+ if (!channel_info) {
return (-3);
}
data[0] = channel_info->channel & 0x0F;
@@ -128,7 +128,7 @@ _ipmi_get_channel_info(struct ipmi_intf *intf,
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
- if (rsp == NULL) {
+ if (!rsp) {
return (-1);
} else if (rsp->ccode) {
return rsp->ccode;
@@ -202,7 +202,7 @@ _ipmi_set_channel_access(struct ipmi_intf *intf,
req.msg.data_len = 3;
rsp = intf->sendrecv(intf, &req);
- if (rsp == NULL) {
+ if (!rsp) {
return (-1);
}
return rsp->ccode;
@@ -284,7 +284,7 @@ ipmi_get_channel_auth_cap(struct ipmi_intf *intf, uint8_t channel, uint8_t priv)
msg_data[0] &= 0x7F;
rsp = intf->sendrecv(intf, &req);
- if (rsp == NULL) {
+ if (!rsp) {
lprintf(LOG_ERR, "Unable to Get Channel Authentication Capabilities");
return (-1);
}
@@ -374,7 +374,7 @@ ipmi_get_channel_cipher_suites(struct ipmi_intf *intf, const char *payload_type,
rqdata[2] = 0x80;
rsp = intf->sendrecv(intf, &req);
- if (rsp == NULL) {
+ if (!rsp) {
lprintf(LOG_ERR, "Unable to Get Channel Cipher Suites");
return -1;
}
@@ -409,7 +409,7 @@ ipmi_get_channel_cipher_suites(struct ipmi_intf *intf, const char *payload_type,
rqdata[2] = (rqdata[2] & 0x80) + list_index;
rsp = intf->sendrecv(intf, &req);
- if (rsp == NULL) {
+ if (!rsp) {
lprintf(LOG_ERR, "Unable to Get Channel Cipher Suites");
return -1;
}