Re: [PATCH net-next 2/2] net: ti: icssg-prueth: Add ethtool RX flow classification support
From: Marco Crivellari
Date: Thu Nov 19 2026 - 04:20:24 EST
Hi,
On Wed, Nov 18, 2026 at 7:50 PM Meghana Malladi <m-malladi@xxxxxx> 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