mirror of
https://github.com/corundum/corundum.git
synced 2025-01-30 08:32:52 +08:00
modules/mqnic: Clean up error handling in common probe; do not fail probe if interface creation fails so userspace tools will still be usable via driver
Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
parent
5133bf5d27
commit
69201fbf82
@ -244,6 +244,8 @@ static int mqnic_platform_module_eeprom_get(struct mqnic_dev *mqnic)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void mqnic_common_remove(struct mqnic_dev *mqnic);
|
||||
|
||||
static int mqnic_common_probe(struct mqnic_dev *mqnic)
|
||||
{
|
||||
int ret = 0;
|
||||
@ -387,6 +389,7 @@ static int mqnic_common_probe(struct mqnic_dev *mqnic)
|
||||
}
|
||||
}
|
||||
|
||||
fail_create_if:
|
||||
mqnic->misc_dev.minor = MISC_DYNAMIC_MINOR;
|
||||
mqnic->misc_dev.name = mqnic->name;
|
||||
mqnic->misc_dev.fops = &mqnic_fops;
|
||||
@ -394,6 +397,7 @@ static int mqnic_common_probe(struct mqnic_dev *mqnic)
|
||||
|
||||
ret = misc_register(&mqnic->misc_dev);
|
||||
if (ret) {
|
||||
mqnic->misc_dev.this_device = NULL;
|
||||
dev_err(dev, "misc_register failed: %d\n", ret);
|
||||
goto fail_miscdev;
|
||||
}
|
||||
@ -405,17 +409,10 @@ static int mqnic_common_probe(struct mqnic_dev *mqnic)
|
||||
|
||||
// error handling
|
||||
fail_miscdev:
|
||||
fail_create_if:
|
||||
for (k = 0; k < ARRAY_SIZE(mqnic->interface); k++)
|
||||
if (mqnic->interface[k])
|
||||
mqnic_destroy_interface(&mqnic->interface[k]);
|
||||
|
||||
mqnic_unregister_phc(mqnic);
|
||||
mqnic_board_deinit(mqnic);
|
||||
fail_board:
|
||||
fail_bar_size:
|
||||
fail_rb_init:
|
||||
free_reg_block_list(mqnic->rb_list);
|
||||
mqnic_common_remove(mqnic);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -423,6 +420,7 @@ static void mqnic_common_remove(struct mqnic_dev *mqnic)
|
||||
{
|
||||
int k = 0;
|
||||
|
||||
if (mqnic->misc_dev.this_device)
|
||||
misc_deregister(&mqnic->misc_dev);
|
||||
|
||||
for (k = 0; k < ARRAY_SIZE(mqnic->interface); k++)
|
||||
@ -437,6 +435,7 @@ static void mqnic_common_remove(struct mqnic_dev *mqnic)
|
||||
} else {
|
||||
mqnic_board_deinit(mqnic);
|
||||
}
|
||||
if (mqnic->rb_list)
|
||||
free_reg_block_list(mqnic->rb_list);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user