aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath5k/attach.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/attach.c')
-rw-r--r--drivers/net/wireless/ath/ath5k/attach.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c
index 123612a8a5c6..c0840aba2715 100644
--- a/drivers/net/wireless/ath/ath5k/attach.c
+++ b/drivers/net/wireless/ath/ath5k/attach.c
@@ -101,28 +101,15 @@ static int ath5k_hw_post(struct ath5k_hw *ah)
101 * -ENODEV if the device is not supported or prints an error msg if something 101 * -ENODEV if the device is not supported or prints an error msg if something
102 * else went wrong. 102 * else went wrong.
103 */ 103 */
104struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc) 104int ath5k_hw_attach(struct ath5k_softc *sc)
105{ 105{
106 struct ath5k_hw *ah; 106 struct ath5k_hw *ah = sc->ah;
107 struct ath_common *common; 107 struct ath_common *common;
108 struct pci_dev *pdev = sc->pdev; 108 struct pci_dev *pdev = sc->pdev;
109 struct ath5k_eeprom_info *ee; 109 struct ath5k_eeprom_info *ee;
110 int ret; 110 int ret;
111 u32 srev; 111 u32 srev;
112 112
113 /*If we passed the test malloc a ath5k_hw struct*/
114 ah = kzalloc(sizeof(struct ath5k_hw), GFP_KERNEL);
115 if (ah == NULL) {
116 ret = -ENOMEM;
117 ATH5K_ERR(sc, "out of memory\n");
118 goto err;
119 }
120
121 ah->ah_sc = sc;
122 ah->ah_sc->ah = ah;
123 ah->ah_iobase = sc->iobase;
124 common = ath5k_hw_common(ah);
125
126 /* 113 /*
127 * HW information 114 * HW information
128 */ 115 */
@@ -347,11 +334,10 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc)
347 /* turn on HW LEDs */ 334 /* turn on HW LEDs */
348 ath5k_hw_set_ledstate(ah, AR5K_LED_INIT); 335 ath5k_hw_set_ledstate(ah, AR5K_LED_INIT);
349 336
350 return ah; 337 return 0;
351err_free: 338err_free:
352 kfree(ah); 339 kfree(ah);
353err: 340 return ret;
354 return ERR_PTR(ret);
355} 341}
356 342
357/** 343/**
@@ -371,5 +357,4 @@ void ath5k_hw_detach(struct ath5k_hw *ah)
371 ath5k_eeprom_detach(ah); 357 ath5k_eeprom_detach(ah);
372 358
373 /* assume interrupts are down */ 359 /* assume interrupts are down */
374 kfree(ah);
375} 360}