diff mbox series

[net-next] net: dsa: ocelot: unlock on error in vsc9959_qos_port_tas_set()

Message ID ZH7tRX2weHlhV4hm@moroto (mailing list archive)
State Accepted
Commit cad7526f33ce1e7d387d1d0568a089e41deec5c2
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: dsa: ocelot: unlock on error in vsc9959_qos_port_tas_set() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers fail 1 blamed authors not CCed: horatiu.vultur@microchip.com; 1 maintainers not CCed: horatiu.vultur@microchip.com
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Dan Carpenter June 6, 2023, 8:24 a.m. UTC
This error path needs call mutex_unlock(&ocelot->tas_lock) before
returning.

Fixes: 2d800bc500fb ("net/sched: taprio: replace tc_taprio_qopt_offload :: enable with a "cmd" enum")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/net/dsa/ocelot/felix_vsc9959.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Vladimir Oltean June 6, 2023, 9:04 a.m. UTC | #1
On Tue, Jun 06, 2023 at 11:24:37AM +0300, Dan Carpenter wrote:
> This error path needs call mutex_unlock(&ocelot->tas_lock) before
> returning.
> 
> Fixes: 2d800bc500fb ("net/sched: taprio: replace tc_taprio_qopt_offload :: enable with a "cmd" enum")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---

Thanks. I had a slightly different patch which only locked the mutex in
the first place if the taprio->cmd was known at all (there's nothing to
serialize otherwise), but I didn't send it in time to resolve the issue,
so yours will have to do as well.

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

>  drivers/net/dsa/ocelot/felix_vsc9959.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
> index 5de6a27052fc..903532ea9fa4 100644
> --- a/drivers/net/dsa/ocelot/felix_vsc9959.c
> +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
> @@ -1424,7 +1424,8 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port,
>  		mutex_unlock(&ocelot->tas_lock);
>  		return 0;
>  	} else if (taprio->cmd != TAPRIO_CMD_REPLACE) {
> -		return -EOPNOTSUPP;
> +		ret = -EOPNOTSUPP;
> +		goto err_unlock;
>  	}
>  
>  	ret = ocelot_port_mqprio(ocelot, port, &taprio->mqprio);
> -- 
> 2.39.2
>
patchwork-bot+netdevbpf@kernel.org June 7, 2023, 9:20 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Tue, 6 Jun 2023 11:24:37 +0300 you wrote:
> This error path needs call mutex_unlock(&ocelot->tas_lock) before
> returning.
> 
> Fixes: 2d800bc500fb ("net/sched: taprio: replace tc_taprio_qopt_offload :: enable with a "cmd" enum")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/net/dsa/ocelot/felix_vsc9959.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
  - [net-next] net: dsa: ocelot: unlock on error in vsc9959_qos_port_tas_set()
    https://git.kernel.org/netdev/net-next/c/cad7526f33ce

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index 5de6a27052fc..903532ea9fa4 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -1424,7 +1424,8 @@  static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port,
 		mutex_unlock(&ocelot->tas_lock);
 		return 0;
 	} else if (taprio->cmd != TAPRIO_CMD_REPLACE) {
-		return -EOPNOTSUPP;
+		ret = -EOPNOTSUPP;
+		goto err_unlock;
 	}
 
 	ret = ocelot_port_mqprio(ocelot, port, &taprio->mqprio);