driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [bug report] staging: vt6656: vnt_beacon_xmit use extra_tx_headroom.
@ 2020-05-23 10:10 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2020-05-23 10:10 UTC (permalink / raw)
  To: tvboxspy; +Cc: devel

Hello Malcolm Priestley,

The patch 9deca1e3e2b6: "staging: vt6656: vnt_beacon_xmit use
extra_tx_headroom." from May 16, 2020, leads to the following static
checker warning:

	drivers/staging/vt6656/rxtx.c:729 vnt_beacon_xmit()
	warn: struct type mismatch 'vnt_beacon_buffer vs vnt_tx_usb_header'

drivers/staging/vt6656/rxtx.c
   660  static int vnt_beacon_xmit(struct vnt_private *priv, struct sk_buff *skb)
   661  {
   662          struct vnt_beacon_buffer *beacon_buffer;
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
So far as I can see this could be declared as a "vnt_tx_usb_header".
The "vnt_tx_usb_header" is the first member of the "vnt_beacon_buffer"
beacon struct.

   663          struct vnt_tx_short_buf_head *short_head;
   664          struct ieee80211_tx_info *info;
   665          struct vnt_usb_send_context *context;
   666          struct ieee80211_mgmt *mgmt_hdr;
   667          unsigned long flags;
   668          u32 frame_size = skb->len + 4;
   669          u16 current_rate, count;
   670  
   671          spin_lock_irqsave(&priv->lock, flags);
   672  
   673          context = vnt_get_free_context(priv);
   674          if (!context) {
   675                  dev_dbg(&priv->usb->dev, "%s No free context!\n", __func__);
   676                  spin_unlock_irqrestore(&priv->lock, flags);
   677                  return -ENOMEM;
   678          }
   679  
   680          context->skb = skb;
   681  
   682          spin_unlock_irqrestore(&priv->lock, flags);
   683  
   684          mgmt_hdr = (struct ieee80211_mgmt *)skb->data;
   685          short_head = skb_push(skb, sizeof(*short_head));
   686          count = skb->len;
   687  
   688          if (priv->bb_type == BB_TYPE_11A) {
   689                  current_rate = RATE_6M;
   690  
   691                  /* Get SignalField,ServiceField,Length */
   692                  vnt_get_phy_field(priv, frame_size, current_rate,
   693                                    PK_TYPE_11A, &short_head->ab);
   694  
   695                  /* Get TimeStampOff */
   696                  short_head->time_stamp_off =
   697                                  vnt_time_stamp_off(priv, current_rate);
   698          } else {
   699                  current_rate = RATE_1M;
   700                  short_head->fifo_ctl |= cpu_to_le16(FIFOCTL_11B);
   701  
   702                  /* Get SignalField,ServiceField,Length */
   703                  vnt_get_phy_field(priv, frame_size, current_rate,
   704                                    PK_TYPE_11B, &short_head->ab);
   705  
   706                  /* Get TimeStampOff */
   707                  short_head->time_stamp_off =
   708                          vnt_time_stamp_off(priv, current_rate);
   709          }
   710  
   711          /* Get Duration */
   712          short_head->duration = mgmt_hdr->duration;
   713  
   714          /* time stamp always 0 */
   715          mgmt_hdr->u.beacon.timestamp = 0;
   716  
   717          info = IEEE80211_SKB_CB(skb);
   718          if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
   719                  struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)mgmt_hdr;
   720  
   721                  hdr->duration_id = 0;
   722                  hdr->seq_ctrl = cpu_to_le16(priv->seq_counter << 4);
   723          }
   724  
   725          priv->seq_counter++;
   726          if (priv->seq_counter > 0x0fff)
   727                  priv->seq_counter = 0;
   728  
   729          beacon_buffer = skb_push(skb, sizeof(struct vnt_tx_usb_header));
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   730          beacon_buffer->usb.tx_byte_count = cpu_to_le16(count);
   731          beacon_buffer->usb.pkt_no = context->pkt_no;
   732          beacon_buffer->usb.type = 0x01;

We only need "beacon_buffer->usb".

   733  
   734          context->type = CONTEXT_BEACON_PACKET;
   735          context->tx_buffer = beacon_buffer;
                ^^^^^^^^^^^^^^^^^^
This is a void pointer.

   736          context->buf_len = skb->len;
   737  
   738          spin_lock_irqsave(&priv->lock, flags);
   739  
   740          if (vnt_tx_context(priv, context))
   741                  ieee80211_free_txskb(priv->hw, context->skb);
   742  
   743          spin_unlock_irqrestore(&priv->lock, flags);
   744  
   745          return 0;
   746  }

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-23 10:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-23 10:10 [bug report] staging: vt6656: vnt_beacon_xmit use extra_tx_headroom Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).