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
|
#endif
|
||||||
|
|
||||||
|
static void mqnic_common_remove(struct mqnic_dev *mqnic);
|
||||||
|
|
||||||
static int mqnic_common_probe(struct mqnic_dev *mqnic)
|
static int mqnic_common_probe(struct mqnic_dev *mqnic)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
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.minor = MISC_DYNAMIC_MINOR;
|
||||||
mqnic->misc_dev.name = mqnic->name;
|
mqnic->misc_dev.name = mqnic->name;
|
||||||
mqnic->misc_dev.fops = &mqnic_fops;
|
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);
|
ret = misc_register(&mqnic->misc_dev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
mqnic->misc_dev.this_device = NULL;
|
||||||
dev_err(dev, "misc_register failed: %d\n", ret);
|
dev_err(dev, "misc_register failed: %d\n", ret);
|
||||||
goto fail_miscdev;
|
goto fail_miscdev;
|
||||||
}
|
}
|
||||||
@ -405,17 +409,10 @@ static int mqnic_common_probe(struct mqnic_dev *mqnic)
|
|||||||
|
|
||||||
// error handling
|
// error handling
|
||||||
fail_miscdev:
|
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_board:
|
||||||
fail_bar_size:
|
fail_bar_size:
|
||||||
fail_rb_init:
|
fail_rb_init:
|
||||||
free_reg_block_list(mqnic->rb_list);
|
mqnic_common_remove(mqnic);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,7 +420,8 @@ static void mqnic_common_remove(struct mqnic_dev *mqnic)
|
|||||||
{
|
{
|
||||||
int k = 0;
|
int k = 0;
|
||||||
|
|
||||||
misc_deregister(&mqnic->misc_dev);
|
if (mqnic->misc_dev.this_device)
|
||||||
|
misc_deregister(&mqnic->misc_dev);
|
||||||
|
|
||||||
for (k = 0; k < ARRAY_SIZE(mqnic->interface); k++)
|
for (k = 0; k < ARRAY_SIZE(mqnic->interface); k++)
|
||||||
if (mqnic->interface[k])
|
if (mqnic->interface[k])
|
||||||
@ -437,7 +435,8 @@ static void mqnic_common_remove(struct mqnic_dev *mqnic)
|
|||||||
} else {
|
} else {
|
||||||
mqnic_board_deinit(mqnic);
|
mqnic_board_deinit(mqnic);
|
||||||
}
|
}
|
||||||
free_reg_block_list(mqnic->rb_list);
|
if (mqnic->rb_list)
|
||||||
|
free_reg_block_list(mqnic->rb_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PCI
|
#ifdef CONFIG_PCI
|
||||||
|
Loading…
x
Reference in New Issue
Block a user