1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-30 08:32:52 +08:00

Clean up return code checks

This commit is contained in:
Alex Forencich 2022-01-08 15:14:49 -08:00
parent 136b0ee6ae
commit 23f635f273
2 changed files with 4 additions and 4 deletions

View File

@ -552,7 +552,7 @@ int main(int argc, char *argv[])
// PCIe device will have a config space, so check for that // PCIe device will have a config space, so check for that
snprintf(path, sizeof(path), "%s/config", device_path); snprintf(path, sizeof(path), "%s/config", device_path);
if (access(path, F_OK) == -1) if (access(path, F_OK))
{ {
perror("failed to determine device path"); perror("failed to determine device path");
ret = -1; ret = -1;
@ -1228,7 +1228,7 @@ skip_flash:
{ {
snprintf(path, sizeof(path), "%s/driver/unbind", device_path); snprintf(path, sizeof(path), "%s/driver/unbind", device_path);
if (access(path, F_OK) != -1) if (access(path, F_OK) == 0)
{ {
printf("Unbinding driver...\n"); printf("Unbinding driver...\n");
write_str_to_file(path, ptr+1); write_str_to_file(path, ptr+1);

View File

@ -62,7 +62,7 @@ struct mqnic *mqnic_open(const char *dev_name)
goto fail_open; goto fail_open;
} }
if (fstat(dev->fd, &st) == -1) if (fstat(dev->fd, &st))
{ {
perror("fstat failed"); perror("fstat failed");
goto fail_fstat; goto fail_fstat;
@ -102,7 +102,7 @@ struct mqnic *mqnic_open(const char *dev_name)
strcpy(++ptr, "enable"); strcpy(++ptr, "enable");
} }
if (access(path, F_OK) != -1) if (access(path, F_OK) == 0)
{ {
FILE *fp = fopen(path, "w"); FILE *fp = fopen(path, "w");