Re: [PATCH net-next] i40e: Use common error handling code in i40e_register_auxiliary_dev()
From: Markus Elfring
Date: Wed Jun 10 2026 - 06:42:23 EST
>> +++ b/drivers/net/ethernet/intel/i40e/i40e_client.c
>> @@ -304,15 +304,15 @@ static int i40e_register_auxiliary_dev(struct i40e_info *ldev,
>> const char *name)
>> ldev->aux_dev = aux_dev;
>>
>> ret = ida_alloc(&i40e_client_ida, GFP_KERNEL);
>> - if (ret < 0) {
>> - kfree(i40e_aux_dev);
>> - return ret;
>> - }
>> + if (ret < 0)
>> + goto free_aux_dev;
>> +
>> aux_dev->id = ret;
>>
>> ret = auxiliary_device_init(aux_dev);
>> if (ret < 0) {
>> ida_free(&i40e_client_ida, aux_dev->id);
>> +free_aux_dev:
>> kfree(i40e_aux_dev);
>> return ret;
> why do you do this? There's no functional change, right?
> is it just readability?
Please take another look at corresponding information sources.
* Centralized exiting of functions
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v7.1-rc7#n526
* https://cmu-sei.github.io/secure-coding-standards/sei-cert-c-coding-standard/recommendations/memory-management-mem/mem12-c/
Would you like to increase the application of scope-based resource management?
Regards,
Markus