mwifiex: simplify the code around ra_list
authorShawn Lin <shawn.lin@rock-chips.com>
Fri, 26 May 2017 01:41:49 +0000 (09:41 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 1 Jun 2017 09:50:09 +0000 (12:50 +0300)
We don't need to check if the list is empty separately
as we could use list_first_entry_or_null to cover it.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/tdls.c
drivers/net/wireless/marvell/mwifiex/wmm.c

index 7d0d3ff3dd4cc02e7a1729a67a743f132c36c2a6..d76ce8797de1740648f25f3591cbbd26ef139f15 100644 (file)
@@ -55,11 +55,8 @@ static void mwifiex_restore_tdls_packets(struct mwifiex_private *priv,
                        tx_info->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT;
                } else {
                        tid_list = &priv->wmm.tid_tbl_ptr[tid_down].ra_list;
-                       if (!list_empty(tid_list))
-                               ra_list = list_first_entry(tid_list,
-                                             struct mwifiex_ra_list_tbl, list);
-                       else
-                               ra_list = NULL;
+                       ra_list = list_first_entry_or_null(tid_list,
+                                       struct mwifiex_ra_list_tbl, list);
                        tx_info->flags &= ~MWIFIEX_BUF_FLAG_TDLS_PKT;
                }
 
index 75cdd55d10462a2b23a961849624db2c61643256..0edd26881321e50335b92d54469b8b7d7357c1ba 100644 (file)
@@ -868,12 +868,8 @@ mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv,
                        return;
                default:
                        list_head = priv->wmm.tid_tbl_ptr[tid_down].ra_list;
-                       if (!list_empty(&list_head))
-                               ra_list = list_first_entry(
-                                       &list_head, struct mwifiex_ra_list_tbl,
-                                       list);
-                       else
-                               ra_list = NULL;
+                       ra_list = list_first_entry_or_null(&list_head,
+                                       struct mwifiex_ra_list_tbl, list);
                        break;
                }
        } else {