Skip to contentSkip to conversation

staging: vt6656: Avoid multiple line dereference

PATCH In review Craig Kewley 2 participants 2 messages Feb 1, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: vt6656: Avoid multiple line dereference

This patch fixes the checkpatch.pl warning:

WARNING: Avoid multiple line dereference

---
 drivers/staging/vt6656/rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/vt6656/rxtx.c +2 -2
index aa59e7f14ab3..7f526c053e0d 100644
@@ -692,8 +692,8 @@ static u16 vnt_generate_tx_parameter(struct vnt_usb_send_context *tx_context,
 	    tx_context->pkt_type == PK_TYPE_11GA) {
 		if (need_rts) {
 			if (need_mic)
-				*mic_hdr = &tx_buffer->
-						tx_head.tx_rts.tx.mic.hdr;
+				*mic_hdr =
+					&tx_buffer->tx_head.tx_rts.tx.mic.hdr;
 
 			return vnt_rxtx_rts(tx_context, &tx_buffer->tx_head,
 					    need_mic);
Signature · 1 line
2.11.0
#1 lore raw
Quoted 2 lines · Craig Kewley

This patch fixes the checkpatch.pl warning:
WARNING: Avoid multiple line dereference

Hi Craig.

Please try to make the code more sensible in preference to just fixing checkpatch warnings.

drivers/staging/vt6656/rxtx.c

Quoted 1 line
drivers/staging/vt6656/rxtx.c +0 -0

[]

drivers/staging/vt6656/rxtx.c static u16 vnt_generate_tx_parameter(struct vnt_usb_send_context *tx_context, · line 699

Quoted 11 lines
drivers/staging/vt6656/rxtx.c +2 -2
@@ -692,8 +692,8 @@ static u16 vnt_generate_tx_parameter(struct vnt_usb_send_context *tx_context,
 	    tx_context->pkt_type == PK_TYPE_11GA) {
 		if (need_rts) {
 			if (need_mic)
-				*mic_hdr = &tx_buffer->
-						tx_head.tx_rts.tx.mic.hdr;
+				*mic_hdr =
+					&tx_buffer->tx_head.tx_rts.tx.mic.hdr;
 
 			return vnt_rxtx_rts(tx_context, &tx_buffer->tx_head,
 					    need_mic);

This block would be more legible using a temporary for &tx_buffer->tx_head like:
---
 drivers/staging/vt6656/rxtx.c | 15 +++++++--------

 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/staging/vt6656/rxtx.c +0 -0
index aa59e7f14ab3..89ca5c20cd1c 100644
@@ -687,28 +687,27 @@ static u16 vnt_generate_tx_parameter(struct vnt_usb_send_context *tx_context,

  struct vnt_mic_hdr **mic_hdr, u32 need_mic,
  bool need_rts)
 {
+ union vnt_tx_head *tx_head = &tx_buffer->tx_head;

  if (tx_context->pkt_type == PK_TYPE_11GB || tx_context->pkt_type == PK_TYPE_11GA) {
  if (need_rts) {
  if (need_mic)
- *mic_hdr = &tx_buffer->
- tx_head.tx_rts.tx.mic.hdr;
+ *mic_hdr = &tx_head->tx_rts.tx.mic.hdr;

- return vnt_rxtx_rts(tx_context, &tx_buffer->tx_head,
-     need_mic);
+ return vnt_rxtx_rts(tx_context, tx_head, need_mic);
  }

  if (need_mic)
- *mic_hdr = &tx_buffer->tx_head.tx_cts.tx.mic.hdr;
+ *mic_hdr = &tx_head->tx_cts.tx.mic.hdr;

- return vnt_rxtx_cts(tx_context, &tx_buffer->tx_head, need_mic);
+ return vnt_rxtx_cts(tx_context, tx_head, need_mic);
  }

  if (need_mic)
- *mic_hdr = &tx_buffer->tx_head.tx_ab.tx.mic.hdr;
+ *mic_hdr = &tx_head->tx_ab.tx.mic.hdr;

- return vnt_rxtx_ab(tx_context, &tx_buffer->tx_head, need_rts, need_mic);
+ return vnt_rxtx_ab(tx_context, tx_head, need_rts, need_mic);
 }

 static void vnt_fill_txkey(struct vnt_usb_send_context *tx_context,