Skip to content

Commit

Permalink
net: mscc: ocelot: fix mutex_lock not released
Browse files Browse the repository at this point in the history
If err is true, the function will be returned, but mutex_lock isn't
released.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Lv Ruyi authored and David S. Miller committed Nov 30, 2021
1 parent c019087 commit 9c32950
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/mscc/ocelot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1651,8 +1651,10 @@ int ocelot_hwstamp_set(struct ocelot *ocelot, int port, struct ifreq *ifr)
}

err = ocelot_setup_ptp_traps(ocelot, port, l2, l4);
if (err)
if (err) {
mutex_unlock(&ocelot->ptp_lock);
return err;
}

if (l2 && l4)
cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
Expand Down

0 comments on commit 9c32950

Please sign in to comment.