Skip to content

Commit 9a9d12e

Browse files
committed
[brcmfmac] Let feature attachment fail, and fail if we can't
handle the interface versions we find. Signed-off-by: Daniel Berlin <[email protected]>
1 parent 55fdad1 commit 9a9d12e

3 files changed

Lines changed: 34 additions & 13 deletions

File tree

drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,9 @@ static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops)
12201220
if (ret < 0)
12211221
goto fail;
12221222

1223-
brcmf_feat_attach(drvr);
1223+
ret = brcmf_feat_attach(drvr);
1224+
if (ret)
1225+
goto fail;
12241226

12251227
/* Setup event_msgs, enable E_IF */
12261228
ret = brcmf_fweh_init_events(ifp);

drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data)
300300
return 0;
301301
}
302302

303-
void brcmf_feat_attach(struct brcmf_pub *drvr)
303+
int brcmf_feat_attach(struct brcmf_pub *drvr)
304304
{
305305
struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
306306
struct brcmf_join_version_le join_ver;
@@ -361,13 +361,14 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
361361
err = brcmf_fil_iovar_data_get(ifp, "join_ver", &join_ver, sizeof(join_ver));
362362
if (!err) {
363363
u16 ver = le16_to_cpu(join_ver.join_ver_major);
364-
brcmf_join_param_setup_for_version(drvr, ver);
364+
err = brcmf_join_param_setup_for_version(drvr, ver);
365365
} else {
366366
/* Default to version 0, unless it is one of the firmware branches
367367
* that doesn't have a join_ver iovar but are still version 1 */
368368
u8 version = 0;
369369
struct brcmf_wlc_version_le ver;
370-
err = brcmf_fil_iovar_data_get(ifp, "wlc_ver", &ver, sizeof(ver));
370+
err = brcmf_fil_iovar_data_get(ifp, "wlc_ver", &ver,
371+
sizeof(ver));
371372
if (!err) {
372373
u16 major = le16_to_cpu(ver.wlc_ver_major);
373374
u16 minor = le16_to_cpu(ver.wlc_ver_minor);
@@ -380,27 +381,42 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
380381
version = 1;
381382
}
382383
}
383-
brcmf_join_param_setup_for_version(drvr, version);
384+
err = brcmf_join_param_setup_for_version(drvr, version);
384385
}
385-
err = brcmf_fil_iovar_data_get(ifp, "scan_ver", &scan_ver, sizeof(scan_ver));
386+
if (err) {
387+
bphy_err(drvr, "Error setting up join structure handler: %d\n",
388+
err);
389+
return err;
390+
}
391+
err = brcmf_fil_iovar_data_get(ifp, "scan_ver", &scan_ver,
392+
sizeof(scan_ver));
386393
if (!err) {
387394
u16 ver = le16_to_cpu(scan_ver.scan_ver_major);
388-
brcmf_scan_param_setup_for_version(drvr, ver);
395+
err = brcmf_scan_param_setup_for_version(drvr, ver);
389396
} else {
390397
/* Default to version 1. */
391-
brcmf_scan_param_setup_for_version(drvr, 1);
398+
err = brcmf_scan_param_setup_for_version(drvr, 1);
399+
}
400+
if (err) {
401+
bphy_err(drvr, "Error setting up scan structure handler: %d\n",
402+
err);
403+
return err;
392404
}
393-
394405
/* See what version of PFN scan is supported*/
395406
err = brcmf_fil_iovar_data_get(ifp, "pno_set", &pno_params,
396407
sizeof(pno_params));
397408
if (!err) {
398-
brcmf_pno_setup_for_version(drvr, le16_to_cpu(pno_params.version));
409+
err = brcmf_pno_setup_for_version(
410+
drvr, le16_to_cpu(pno_params.version));
399411
} else {
400412
/* Default to version 2, supported by all chips we support. */
401-
brcmf_pno_setup_for_version(drvr, 2);
413+
err = brcmf_pno_setup_for_version(drvr, 2);
414+
}
415+
if (err) {
416+
bphy_err(drvr, "Error setting up escan structure handler: %d\n",
417+
err);
418+
return err;
402419
}
403-
404420
if (drvr->settings->feature_disable) {
405421
brcmf_dbg(INFO, "Features: 0x%02x, disable: 0x%02x\n",
406422
ifp->drvr->feat_flags,
@@ -423,6 +439,7 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
423439
/* no quirks */
424440
break;
425441
}
442+
return 0;
426443
}
427444

428445
void brcmf_feat_debugfs_create(struct brcmf_pub *drvr)

drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ enum brcmf_feat_quirk {
100100
* brcmf_feat_attach() - determine features and quirks.
101101
*
102102
* @drvr: driver instance.
103+
*
104+
* Return: 0 in case of success, error code otherwise.
103105
*/
104-
void brcmf_feat_attach(struct brcmf_pub *drvr);
106+
int brcmf_feat_attach(struct brcmf_pub *drvr);
105107

106108
/**
107109
* brcmf_feat_debugfs_create() - create debugfs entries.

0 commit comments

Comments
 (0)