aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2013-07-15 07:15:08 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-07-22 16:54:40 -0400
commitfd4edf197544bae1c77d84bad354aa7ce1d08ce1 (patch)
tree3a431ba000456c6b76e4417a5764a766dac81743 /drivers/bcma
parent1cabf7dba57011339d7e5a44b2c9829305936372 (diff)
bcma: fix handling of big addrl
The return value of bcma_erom_get_addr_desc() is a unsigned value and it could wrap around in the two complement writing. This happens for one core in the BCM4708 SoC. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma')
-rw-r--r--drivers/bcma/scan.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
index f2f1415376db..cd6b20fce680 100644
--- a/drivers/bcma/scan.c
+++ b/drivers/bcma/scan.c
@@ -213,7 +213,7 @@ static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 __iomem **eromptr)
213 return ent; 213 return ent;
214} 214}
215 215
216static s32 bcma_erom_get_addr_desc(struct bcma_bus *bus, u32 __iomem **eromptr, 216static u32 bcma_erom_get_addr_desc(struct bcma_bus *bus, u32 __iomem **eromptr,
217 u32 type, u8 port) 217 u32 type, u8 port)
218{ 218{
219 u32 addrl, addrh, sizel, sizeh = 0; 219 u32 addrl, addrh, sizel, sizeh = 0;
@@ -225,7 +225,7 @@ static s32 bcma_erom_get_addr_desc(struct bcma_bus *bus, u32 __iomem **eromptr,
225 ((ent & SCAN_ADDR_TYPE) != type) || 225 ((ent & SCAN_ADDR_TYPE) != type) ||
226 (((ent & SCAN_ADDR_PORT) >> SCAN_ADDR_PORT_SHIFT) != port)) { 226 (((ent & SCAN_ADDR_PORT) >> SCAN_ADDR_PORT_SHIFT) != port)) {
227 bcma_erom_push_ent(eromptr); 227 bcma_erom_push_ent(eromptr);
228 return -EINVAL; 228 return (u32)-EINVAL;
229 } 229 }
230 230
231 addrl = ent & SCAN_ADDR_ADDR; 231 addrl = ent & SCAN_ADDR_ADDR;
@@ -273,7 +273,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
273 struct bcma_device_id *match, int core_num, 273 struct bcma_device_id *match, int core_num,
274 struct bcma_device *core) 274 struct bcma_device *core)
275{ 275{
276 s32 tmp; 276 u32 tmp;
277 u8 i, j; 277 u8 i, j;
278 s32 cia, cib; 278 s32 cia, cib;
279 u8 ports[2], wrappers[2]; 279 u8 ports[2], wrappers[2];
@@ -351,11 +351,11 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
351 * the main register space for the core 351 * the main register space for the core
352 */ 352 */
353 tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_SLAVE, 0); 353 tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_SLAVE, 0);
354 if (tmp <= 0) { 354 if (tmp == 0 || IS_ERR_VALUE(tmp)) {
355 /* Try again to see if it is a bridge */ 355 /* Try again to see if it is a bridge */
356 tmp = bcma_erom_get_addr_desc(bus, eromptr, 356 tmp = bcma_erom_get_addr_desc(bus, eromptr,
357 SCAN_ADDR_TYPE_BRIDGE, 0); 357 SCAN_ADDR_TYPE_BRIDGE, 0);
358 if (tmp <= 0) { 358 if (tmp == 0 || IS_ERR_VALUE(tmp)) {
359 return -EILSEQ; 359 return -EILSEQ;
360 } else { 360 } else {
361 bcma_info(bus, "Bridge found\n"); 361 bcma_info(bus, "Bridge found\n");
@@ -369,7 +369,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
369 for (j = 0; ; j++) { 369 for (j = 0; ; j++) {
370 tmp = bcma_erom_get_addr_desc(bus, eromptr, 370 tmp = bcma_erom_get_addr_desc(bus, eromptr,
371 SCAN_ADDR_TYPE_SLAVE, i); 371 SCAN_ADDR_TYPE_SLAVE, i);
372 if (tmp < 0) { 372 if (IS_ERR_VALUE(tmp)) {
373 /* no more entries for port _i_ */ 373 /* no more entries for port _i_ */
374 /* pr_debug("erom: slave port %d " 374 /* pr_debug("erom: slave port %d "
375 * "has %d descriptors\n", i, j); */ 375 * "has %d descriptors\n", i, j); */
@@ -386,7 +386,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
386 for (j = 0; ; j++) { 386 for (j = 0; ; j++) {
387 tmp = bcma_erom_get_addr_desc(bus, eromptr, 387 tmp = bcma_erom_get_addr_desc(bus, eromptr,
388 SCAN_ADDR_TYPE_MWRAP, i); 388 SCAN_ADDR_TYPE_MWRAP, i);
389 if (tmp < 0) { 389 if (IS_ERR_VALUE(tmp)) {
390 /* no more entries for port _i_ */ 390 /* no more entries for port _i_ */
391 /* pr_debug("erom: master wrapper %d " 391 /* pr_debug("erom: master wrapper %d "
392 * "has %d descriptors\n", i, j); */ 392 * "has %d descriptors\n", i, j); */
@@ -404,7 +404,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
404 for (j = 0; ; j++) { 404 for (j = 0; ; j++) {
405 tmp = bcma_erom_get_addr_desc(bus, eromptr, 405 tmp = bcma_erom_get_addr_desc(bus, eromptr,
406 SCAN_ADDR_TYPE_SWRAP, i + hack); 406 SCAN_ADDR_TYPE_SWRAP, i + hack);
407 if (tmp < 0) { 407 if (IS_ERR_VALUE(tmp)) {
408 /* no more entries for port _i_ */ 408 /* no more entries for port _i_ */
409 /* pr_debug("erom: master wrapper %d " 409 /* pr_debug("erom: master wrapper %d "
410 * has %d descriptors\n", i, j); */ 410 * has %d descriptors\n", i, j); */