From: Johannes Berg Date: Fri, 2 May 2008 22:44:09 +0000 (+0200) Subject: mac80211: fix wme code X-Git-Tag: v2.6.27-rc1~969^2~449 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=5c5e12898af0978a780991950be12d0d73c02f04;p=linux-2.6-omap-h63xx.git mac80211: fix wme code In commit e100bb64bf7cdeae7f742a65ee1985649a7fd1b4 (mac80211: QoS related cleanups) I accidentally changed a variable from int to u16 causing a warning that a comparison for < 0 was always false. John thought this was a missing deletion of code and removed the warning by deleting the never executed branch of code in commit 3df5ee60f1ee559b1417397461891f8b483e8089 (wireless: fix warning introduced by "mac80211: QoS related cleanups") but the problem really was my mistake of using a u16 variable for the queue variable when that variable can also contain an error code. This patch restores the original code and variable type. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c index b1e20ca03ff..8ffff27fe00 100644 --- a/net/mac80211/wme.c +++ b/net/mac80211/wme.c @@ -155,8 +155,7 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd) unsigned short fc = le16_to_cpu(hdr->frame_control); struct Qdisc *qdisc; struct sta_info *sta; - int err; - u16 queue; + int err, queue; u8 tid; if (pkt_data->flags & IEEE80211_TXPD_REQUEUE) { @@ -216,15 +215,20 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd) rcu_read_unlock(); } - tid = skb->priority & QOS_CONTROL_TAG1D_MASK; - pkt_data->queue = (unsigned int) queue; - qdisc = q->queues[queue]; - err = qdisc->enqueue(skb, qdisc); - if (err == NET_XMIT_SUCCESS) { - qd->q.qlen++; - qd->bstats.bytes += skb->len; - qd->bstats.packets++; - return NET_XMIT_SUCCESS; + if (unlikely(queue < 0)) { + kfree_skb(skb); + err = NET_XMIT_DROP; + } else { + tid = skb->priority & QOS_CONTROL_TAG1D_MASK; + pkt_data->queue = (unsigned int) queue; + qdisc = q->queues[queue]; + err = qdisc->enqueue(skb, qdisc); + if (err == NET_XMIT_SUCCESS) { + qd->q.qlen++; + qd->bstats.bytes += skb->len; + qd->bstats.packets++; + return NET_XMIT_SUCCESS; + } } qd->qstats.drops++; return err;