> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf
> Of Markus Elfring
> Sent: Wednesday, June 10, 2026 10:20 AM
> To: [email protected]; [email protected]; Andrew
> Lunn <[email protected]>; David S. Miller <[email protected]>;
> Eric Dumazet <[email protected]>; Jakub Kicinski
> <[email protected]>; Paolo Abeni <[email protected]>; Kitszel,
> Przemyslaw <[email protected]>; Shiraz Saleem
> <[email protected]>; Nguyen, Anthony L
> <[email protected]>
> Cc: LKML <[email protected]>; kernel-
> [email protected]
> Subject: [Intel-wired-lan] [PATCH net-next] i40e: Use common error
> handling code in i40e_register_auxiliary_dev()
> 
> From: Markus Elfring <[email protected]>
> Date: Wed, 10 Jun 2026 10:02:58 +0200
> 
> Use an additional label so that a bit of exception handling can be
> better reused at the end of an if branch.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <[email protected]>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_client.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_client.c
> b/drivers/net/ethernet/intel/i40e/i40e_client.c
> index 84a97ca8a6d8..389b8b83afbd 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_client.c
> +++ 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);
It's not linux kernel error handling.
Please, either leave the original code as-is — the two-line duplication is not 
a real problem.
Or submit a proper two-label refactor with a clear commit message.

> +free_aux_dev:
>               kfree(i40e_aux_dev);
>               return ret;
>       }
> --
> 2.54.0

Reply via email to