Skip to contentSkip to conversation

bcma: suspend/resume callbacks should be conditionally compiled on CONFIG_PM_SLEEP

PATCH New John Greene 1 participant 3 messages May 13, 2013 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore
#1 lore raw

PATCH 87/176 bcma: suspend/resume callbacks should be conditionally compiled on CONFIG_PM_SLEEP

In reply to a message not in the archive

Bugzilla: 757944
Brew: <https://brewweb.devel.redhat.com/taskinfo?taskID=5738553>
Upstream Status: ccd609538e99d3465a8d498f3655098f44cd253b
Tested: By me. Acceptable. See BZ for details

This will fix warnings like following when CONFIG_PM_SLEEP is not set:

warning: 'xxx_suspend' defined but not used [-Wunused-function]
warning: 'xxx_resume' defined but not used [-Wunused-function]

Because
SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)

Only references the callbacks on CONFIG_PM_SLEEP (instead of CONFIG_PM).

---
 drivers/bcma/host_pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/bcma/host_pci.c +3 -3
index b6b4b5e..98fdc3e 100644
@@ -238,7 +238,7 @@ static void __devexit bcma_host_pci_remove(struct pci_dev *dev)
 	pci_set_drvdata(dev, NULL);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int bcma_host_pci_suspend(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
@@ -261,11 +261,11 @@ static SIMPLE_DEV_PM_OPS(bcma_pm_ops, bcma_host_pci_suspend,
 			 bcma_host_pci_resume);
 #define BCMA_PM_OPS	(&bcma_pm_ops)
 
-#else /* CONFIG_PM */
+#else /* CONFIG_PM_SLEEP */
 
 #define BCMA_PM_OPS     NULL
 
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM_SLEEP */
 
 static DEFINE_PCI_DEVICE_TABLE(bcma_pci_bridge_tbl) = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x0576) },
Signature · 1 line
1.7.11.7
#3 lore raw

PATCH 170/176 brcmsmac: avoid 512 byte stack variable

In reply to a message not in the archive

Bugzilla: 757944
Brew: <https://brewweb.devel.redhat.com/taskinfo?taskID=5738553>
Upstream Status: 0d61c9177cb9bf48dcec9c3d9205a309085d4318
Tested: By me. Acceptable. See BZ for details

Dynamically allocate the probe response template which avoids potential stack corruption. Observed with smatch:

drivers/net/wireless/brcm80211/brcmsmac/main.c:7412 brcms_c_bss_update_probe_resp()
warn: 'prb_resp' puts 512 bytes on stack

Cc Brett Rudley <[email protected]>
Cc Arend van Spriel <[email protected]>
Cc "Franky (Zhenhui) Lin" <[email protected]>
Cc Hante Meuleman <[email protected]>
Cc "John W. Linville" <[email protected]>
Cc Seth Forshee <[email protected]>
Cc Pieter-Paul Giesberts <[email protected]>
Cc Hauke Mehrtens <[email protected]>
---
 drivers/net/wireless/brcm80211/brcmsmac/main.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/brcm80211/brcmsmac/main.c +7 -1
index c72fbab..8ec610e 100644
@@ -7398,9 +7398,13 @@ brcms_c_bss_update_probe_resp(struct brcms_c_info *wlc,
 			      struct brcms_bss_cfg *cfg,
 			      bool suspend)
 {
-	u16 prb_resp[BCN_TMPL_LEN / 2];
+	u16 *prb_resp;
 	int len = BCN_TMPL_LEN;
 
+	prb_resp = kmalloc(BCN_TMPL_LEN, GFP_ATOMIC);
+	if (!prb_resp)
+		return;
+
 	/*
 	 * write the probe response to hardware, or save in
 	 * the config structure
@@ -7434,6 +7438,8 @@ brcms_c_bss_update_probe_resp(struct brcms_c_info *wlc,
 
 	if (suspend)
 		brcms_c_enable_mac(wlc);
+
+	kfree(prb_resp);
 }
 
 void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend)
Signature · 1 line
1.7.11.7
#2 lore raw

PATCH 169/176 brcmsmac: fix u16 overflow warning

In reply to a message not in the archive

Bugzilla: 757944
Brew: <https://brewweb.devel.redhat.com/taskinfo?taskID=5738553>
Upstream Status: 708eb54f20334470ad92042547db0fef0cd60462
Tested: By me. Acceptable. See BZ for details

DOT11_MIN_BEACON_PERIOD and DOT11_MAX_BEACON_PERIOD are superfluous. The only invalid beacon period is 0. Comparing a 16 bit quantity to 0xffff also causes a compile warning:

drivers/net/wireless/brcm80211/brcmsmac/main.c:5560 brcms_c_set_beacon_period()
warn: impossible condition '(period > 65535) => (0-65535 > 65535)'

Observed from smatch analysis.

Cc Brett Rudley <[email protected]>
Cc Arend van Spriel <[email protected]>
Cc "Franky (Zhenhui) Lin" <[email protected]>
Cc Hante Meuleman <[email protected]>
Cc "John W. Linville" <[email protected]>
Cc Pieter-Paul Giesberts <[email protected]>
Cc Seth Forshee <[email protected]>
Cc Hauke Mehrtens <[email protected]>
---
 drivers/net/wireless/brcm80211/brcmsmac/main.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/main.c +1 -4
index 5c50b79..c72fbab 100644
@@ -101,8 +101,6 @@
 #define DOT11_RTS_LEN			16
 #define DOT11_CTS_LEN			10
 #define DOT11_BA_BITMAP_LEN		128
-#define DOT11_MIN_BEACON_PERIOD		1
-#define DOT11_MAX_BEACON_PERIOD		0xFFFF
 #define DOT11_MAXNUMFRAGS		16
 #define DOT11_MAX_FRAG_LEN		2346
 
@@ -5548,8 +5546,7 @@ int brcms_c_set_rateset(struct brcms_c_info *wlc, struct brcm_rateset *rs)
 
 int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period)
 {
-	if (period < DOT11_MIN_BEACON_PERIOD ||
-	    period > DOT11_MAX_BEACON_PERIOD)
+	if (period == 0)
 		return -EINVAL;
 
 	wlc->default_bss->beacon_period = period;
Signature · 1 line
1.7.11.7