net: dsa: sja1105: Add missing spin_unlock
diff mbox series

Message ID 20190717141200.46604-1-yuehaibing@huawei.com
State Accepted
Commit 008cfbaa3f9f84efead76d2cea12b4dd05cce67d
Headers show
Series
  • net: dsa: sja1105: Add missing spin_unlock
Related show

Commit Message

YueHaibing July 17, 2019, 2:12 p.m. UTC
It should call spin_unlock() before return NULL.
Detected by Coccinelle.

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: f3097be21bf1 net: ("dsa: sja1105: Add a state machine for RX timestamping")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 net/dsa/tag_sja1105.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Vladimir Oltean July 17, 2019, 6 p.m. UTC | #1
On Wed, 17 Jul 2019 at 17:12, YueHaibing <yuehaibing@huawei.com> wrote:
>
> It should call spin_unlock() before return NULL.
> Detected by Coccinelle.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes: f3097be21bf1 net: ("dsa: sja1105: Add a state machine for RX timestamping")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---

Hi Yue,

Thanks for the patch. Wei Yongjun submitted an identical one a few
hours before yours: https://patchwork.ozlabs.org/patch/1133135/
Let's go with that version this time.

>  net/dsa/tag_sja1105.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c
> index 1d96c9d..26363d7 100644
> --- a/net/dsa/tag_sja1105.c
> +++ b/net/dsa/tag_sja1105.c
> @@ -216,6 +216,7 @@ static struct sk_buff
>                 if (!skb) {
>                         dev_err_ratelimited(dp->ds->dev,
>                                             "Failed to copy stampable skb\n");
> +                       spin_unlock(&sp->data->meta_lock);
>                         return NULL;
>                 }
>                 sja1105_transfer_meta(skb, meta);
> --
> 2.7.4
>
>

Regards,
-Vladimir

Patch
diff mbox series

diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c
index 1d96c9d..26363d7 100644
--- a/net/dsa/tag_sja1105.c
+++ b/net/dsa/tag_sja1105.c
@@ -216,6 +216,7 @@  static struct sk_buff
 		if (!skb) {
 			dev_err_ratelimited(dp->ds->dev,
 					    "Failed to copy stampable skb\n");
+			spin_unlock(&sp->data->meta_lock);
 			return NULL;
 		}
 		sja1105_transfer_meta(skb, meta);