2017-05-26 01:43:39

by Shawn Lin

[permalink] [raw]
Subject: [PATCH] mwifiex: simplify the code around ra_list

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 <[email protected]>
---

drivers/net/wireless/marvell/mwifiex/tdls.c | 7 ++-----
drivers/net/wireless/marvell/mwifiex/wmm.c | 8 ++------
2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/tdls.c b/drivers/net/wireless/marvell/mwifiex/tdls.c
index 7d0d3ff..d76ce87 100644
--- a/drivers/net/wireless/marvell/mwifiex/tdls.c
+++ b/drivers/net/wireless/marvell/mwifiex/tdls.c
@@ -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;
}

diff --git a/drivers/net/wireless/marvell/mwifiex/wmm.c b/drivers/net/wireless/marvell/mwifiex/wmm.c
index e4ff3b9..744b014 100644
--- a/drivers/net/wireless/marvell/mwifiex/wmm.c
+++ b/drivers/net/wireless/marvell/mwifiex/wmm.c
@@ -868,12 +868,8 @@ struct mwifiex_ra_list_tbl *
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 {
--
1.9.1


2017-05-26 16:46:47

by Brian Norris

[permalink] [raw]
Subject: Re: [PATCH] mwifiex: simplify the code around ra_list

On Fri, May 26, 2017 at 09:41:49AM +0800, Shawn Lin wrote:
> 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 <[email protected]>

Looks fine to me.

Reviewed-by: Brian Norris <[email protected]>

2017-06-01 09:51:19

by Kalle Valo

[permalink] [raw]
Subject: Re: mwifiex: simplify the code around ra_list

Shawn Lin <[email protected]> wrote:

> 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 <[email protected]>
> Reviewed-by: Brian Norris <[email protected]>

Patch applied to wireless-drivers-next.git, thanks.

01926202b34b mwifiex: simplify the code around ra_list

--
https://patchwork.kernel.org/patch/9749573/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches