diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2012-12-29 08:51:51 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-01-07 15:16:54 -0500 |
commit | a02308e931ad0bba19803779bec491c4b2d67b47 (patch) | |
tree | a4b4f475811c87b5e0b0e4b5dff36777b6c085c9 /drivers/net/wireless/rt2x00/rt2800pci.c | |
parent | e1b97c9bc5902ec8b36247bcb7c3552895611485 (diff) |
rt2x00: rt2800: convert read_eeprom functions to return an int value
Both the rtt2x00usb_eeprom_read and the ioremap
functions are allowed to fail, however their
return values are not checked in the read_eeprom
functions in the rt2800{pci,usb} drivers.
The patch adds the missing checks, and converts
all read_eeprom functions to return an int value,
so the error values can be propagated up to the
'rt2800_validate_eeprom' function.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 9224d874bf24..0e8d1705e368 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -90,17 +90,22 @@ static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token) | |||
90 | } | 90 | } |
91 | 91 | ||
92 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 92 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) |
93 | static void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) | 93 | static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) |
94 | { | 94 | { |
95 | void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); | 95 | void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); |
96 | 96 | ||
97 | if (!base_addr) | ||
98 | return -ENOMEM; | ||
99 | |||
97 | memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE); | 100 | memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE); |
98 | 101 | ||
99 | iounmap(base_addr); | 102 | iounmap(base_addr); |
103 | return 0; | ||
100 | } | 104 | } |
101 | #else | 105 | #else |
102 | static inline void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) | 106 | static inline int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) |
103 | { | 107 | { |
108 | return -ENOMEM; | ||
104 | } | 109 | } |
105 | #endif /* CONFIG_RALINK_RT288X || CONFIG_RALINK_RT305X */ | 110 | #endif /* CONFIG_RALINK_RT288X || CONFIG_RALINK_RT305X */ |
106 | 111 | ||
@@ -135,7 +140,7 @@ static void rt2800pci_eepromregister_write(struct eeprom_93cx6 *eeprom) | |||
135 | rt2x00pci_register_write(rt2x00dev, E2PROM_CSR, reg); | 140 | rt2x00pci_register_write(rt2x00dev, E2PROM_CSR, reg); |
136 | } | 141 | } |
137 | 142 | ||
138 | static void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev) | 143 | static int rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev) |
139 | { | 144 | { |
140 | struct eeprom_93cx6 eeprom; | 145 | struct eeprom_93cx6 eeprom; |
141 | u32 reg; | 146 | u32 reg; |
@@ -164,6 +169,8 @@ static void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev) | |||
164 | 169 | ||
165 | eeprom_93cx6_multiread(&eeprom, EEPROM_BASE, rt2x00dev->eeprom, | 170 | eeprom_93cx6_multiread(&eeprom, EEPROM_BASE, rt2x00dev->eeprom, |
166 | EEPROM_SIZE / sizeof(u16)); | 171 | EEPROM_SIZE / sizeof(u16)); |
172 | |||
173 | return 0; | ||
167 | } | 174 | } |
168 | 175 | ||
169 | static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev) | 176 | static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev) |
@@ -171,13 +178,14 @@ static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev) | |||
171 | return rt2800_efuse_detect(rt2x00dev); | 178 | return rt2800_efuse_detect(rt2x00dev); |
172 | } | 179 | } |
173 | 180 | ||
174 | static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) | 181 | static inline int rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) |
175 | { | 182 | { |
176 | rt2800_read_eeprom_efuse(rt2x00dev); | 183 | return rt2800_read_eeprom_efuse(rt2x00dev); |
177 | } | 184 | } |
178 | #else | 185 | #else |
179 | static inline void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev) | 186 | static inline int rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev) |
180 | { | 187 | { |
188 | return -EOPNOTSUPP; | ||
181 | } | 189 | } |
182 | 190 | ||
183 | static inline int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev) | 191 | static inline int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev) |
@@ -185,8 +193,9 @@ static inline int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev) | |||
185 | return 0; | 193 | return 0; |
186 | } | 194 | } |
187 | 195 | ||
188 | static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) | 196 | static inline int rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) |
189 | { | 197 | { |
198 | return -EOPNOTSUPP; | ||
190 | } | 199 | } |
191 | #endif /* CONFIG_PCI */ | 200 | #endif /* CONFIG_PCI */ |
192 | 201 | ||
@@ -970,14 +979,18 @@ static irqreturn_t rt2800pci_interrupt(int irq, void *dev_instance) | |||
970 | /* | 979 | /* |
971 | * Device probe functions. | 980 | * Device probe functions. |
972 | */ | 981 | */ |
973 | static void rt2800pci_read_eeprom(struct rt2x00_dev *rt2x00dev) | 982 | static int rt2800pci_read_eeprom(struct rt2x00_dev *rt2x00dev) |
974 | { | 983 | { |
984 | int retval; | ||
985 | |||
975 | if (rt2x00_is_soc(rt2x00dev)) | 986 | if (rt2x00_is_soc(rt2x00dev)) |
976 | rt2800pci_read_eeprom_soc(rt2x00dev); | 987 | retval = rt2800pci_read_eeprom_soc(rt2x00dev); |
977 | else if (rt2800pci_efuse_detect(rt2x00dev)) | 988 | else if (rt2800pci_efuse_detect(rt2x00dev)) |
978 | rt2800pci_read_eeprom_efuse(rt2x00dev); | 989 | retval = rt2800pci_read_eeprom_efuse(rt2x00dev); |
979 | else | 990 | else |
980 | rt2800pci_read_eeprom_pci(rt2x00dev); | 991 | retval = rt2800pci_read_eeprom_pci(rt2x00dev); |
992 | |||
993 | return retval; | ||
981 | } | 994 | } |
982 | 995 | ||
983 | static const struct ieee80211_ops rt2800pci_mac80211_ops = { | 996 | static const struct ieee80211_ops rt2800pci_mac80211_ops = { |