1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-16 08:12:53 +08:00

Improve error handling

This commit is contained in:
Alex Forencich 2020-02-03 17:01:00 -08:00
parent 239b7ddd0b
commit fe8fdab002

View File

@ -75,8 +75,7 @@ struct mqnic *mqnic_open(const char *dev_name)
if (mqnic_reg_read32(dev->regs, MQNIC_REG_FW_ID) == 0xffffffff)
{
fprintf(stderr, "Error: device needs to be reset\n");
munmap((void *)dev->regs, dev->regs_size);
goto fail_mmap_regs;
goto fail_reset;
}
dev->fw_id = mqnic_reg_read32(dev->regs, MQNIC_REG_FW_ID);
@ -163,6 +162,8 @@ struct mqnic *mqnic_open(const char *dev_name)
return dev;
fail_reset:
munmap((void *)dev->regs, dev->regs_size);
fail_mmap_regs:
fail_ioctl:
close(dev->fd);