From: Malcolm Priestley Date: Tue, 27 Aug 2013 10:48:34 +0000 (+0100) Subject: staging: vt6656: s_vFillCTSHead join structures of vnt_cts* to union vnt_tx_data_head X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=27df3ebf363bc1a63ab2356975848a07fb2229dc;p=openwrt%2Fstaging%2Fblogic.git staging: vt6656: s_vFillCTSHead join structures of vnt_cts* to union vnt_tx_data_head Only one of vnt_rts*/vnt_cts* structures are accessed at any one time. structures vnt_cts and vnt_cts_fb are members of union vnt_tx_data_head. Create pointer union head and point structures to the correct member. Point the union to pvCTS. Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 98224bc3ea5f..fd3c59824152 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -760,15 +760,15 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, u8 byPktType, void *pvCTS, u32 cbFrameLength, int bNeedAck, u16 wCurrentRate, u8 byFBOption) { + union vnt_tx_data_head *head = pvCTS; u32 uCTSFrameLen = 14; - if (pvCTS == NULL) { - return; - } + if (!head) + return; if (byFBOption != AUTO_FB_NONE) { /* Auto Fall back */ - struct vnt_cts_fb *pBuf = (struct vnt_cts_fb *)pvCTS; + struct vnt_cts_fb *pBuf = &head->cts_g_fb; /* Get SignalField,ServiceField,Length */ BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b); @@ -788,7 +788,7 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx, pBuf->data.frame_control = TYPE_CTL_CTS; memcpy(pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN); } else { - struct vnt_cts *pBuf = (struct vnt_cts *)pvCTS; + struct vnt_cts *pBuf = &head->cts_g; /* Get SignalField,ServiceField,Length */ BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);