[PATCH net-next 2/2] net: ti: icssg-prueth: Add ethtool RX flow classification support

Marco Crivellari marco.crivellari at suse.com
Thu Nov 19 01:19:48 PST 2026


Hi,

On Wed, Nov 18, 2026 at 7:50 PM Meghana Malladi <m-malladi at ti.com> wrote:
> [...]
> +       mutex_lock(&emac->rxnfc.rxnfc_lock);
> +
> +       /* Check max rules */
> +       if (emac->rxnfc.rxnfc_rule_count >= ICSSG_RXNFC_MAX_RULES) {
> +               ret = -ENOSPC;
> +               goto unlock;
> +       }
>  [...]
> +
> +unlock:
> +       mutex_unlock(&emac->rxnfc.rxnfc_lock);
> +       return ret;
> +}
> +EXPORT_SYMBOL_GPL(icssg_rxnfc_rule_add);

nit: instead of mutex_lock() you can use guard() [1]:

    guard(mutex)(&emac->rxnfc.rxnfc_lock)

and remove all the "goto unlock", returning directly. This handles the
automatic cleanup.

Same for other places where you're using mutex_lock() / mutex_unlock().

- [1] https://docs.kernel.org/core-api/cleanup.html

-- 

Marco Crivellari

SUSE Labs



More information about the linux-arm-kernel mailing list