gpio: rcar: Fix runtime PM imbalance on error
[linux/fpc-iii.git] / drivers / net / wireless / mediatek / mt7601u / util.c
blob050c2dd9d5314eeec7cf9ed8b5aeb6b9c6e3c205
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
4 */
6 #include "mt7601u.h"
8 void mt76_remove_hdr_pad(struct sk_buff *skb)
10 int len = ieee80211_get_hdrlen_from_skb(skb);
12 memmove(skb->data + 2, skb->data, len);
13 skb_pull(skb, 2);
16 int mt76_insert_hdr_pad(struct sk_buff *skb)
18 int len = ieee80211_get_hdrlen_from_skb(skb);
19 int ret;
21 if (len % 4 == 0)
22 return 0;
24 ret = skb_cow(skb, 2);
25 if (ret)
26 return ret;
28 skb_push(skb, 2);
29 memmove(skb->data, skb->data + 2, len);
31 skb->data[len] = 0;
32 skb->data[len + 1] = 0;
33 return 0;