Re: [PATCH 1/7] staging: wfx: simplify memory allocation in wfx_update_filtering()

From: Dan Carpenter
Date: Tue Oct 08 2019 - 07:59:42 EST


These patches are good. I just have a few nits to point out for future
reference.

On Tue, Oct 08, 2019 at 09:42:58AM +0000, Jerome Pouiller wrote:
> static inline int hif_set_beacon_filter_table(struct wfx_vif *wvif,
> - struct hif_mib_bcn_filter_table *ft)
> + int tbl_len,
> + struct hif_ie_table_entry *tbl)
> {
> - size_t buf_len = struct_size(ft, ie_table, ft->num_of_info_elmts);
> + int ret;
> + struct hif_mib_bcn_filter_table *val;
> + int buf_len = struct_size(val, ie_table, tbl_len);

This is fine for now, but since this is networking code, in the future
could you write your declarations in reverse Christmas tree order?

long laskdfjasldfj asldfkj aslkdfj alskdfj askldfj;
mid asdfasdflkajdflasjdf lkasjdf;
short asdfasd;
shortest i;

>
> - cpu_to_le32s(&ft->num_of_info_elmts);
> - return hif_write_mib(wvif->wdev, wvif->id,
> - HIF_MIB_ID_BEACON_FILTER_TABLE, ft, buf_len);

[ snip ]

> diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
> index 2855d14a709c..12198b8f3685 100644
> --- a/drivers/staging/wfx/sta.c
> +++ b/drivers/staging/wfx/sta.c
> @@ -217,14 +217,13 @@ void wfx_update_filtering(struct wfx_vif *wvif)
> bool filter_bssid = wvif->filter_bssid;
> bool fwd_probe_req = wvif->fwd_probe_req;
> struct hif_mib_bcn_filter_enable bf_ctrl;
> - struct hif_mib_bcn_filter_table *bf_tbl;
> - struct hif_ie_table_entry ie_tbl[] = {
> + struct hif_ie_table_entry filter_ies[] = {
> {
> .ie_id = WLAN_EID_VENDOR_SPECIFIC,
> .has_changed = 1,
> .no_longer = 1,
> .has_appeared = 1,
> - .oui = { 0x50, 0x6F, 0x9A},
> + .oui = { 0x50, 0x6F, 0x9A },

Please don't do unrelated white space changes in their own patches.

> }, {
> .ie_id = WLAN_EID_HT_OPERATION,
> .has_changed = 1,

regards,
dan carpenter