diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2013-09-07 11:02:49 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-09-09 14:44:33 -0400 |
commit | aaa2ced15ad8dca8048666c9f70736424d696a6b (patch) | |
tree | 5f1e3886781213fb9091ee15c01b88c2fa9d3876 /drivers/bcma | |
parent | 8a10da264663f97ad8b5c85343274ad903b32196 (diff) |
bcma: fix error code handling on 64 Bit systems
On most 64 Bit systems unsigned long is 64 bit long and then -MAX_ERRNO
is out of the range of a u32 used to store the error code in.
This patch casts the -MAX_ERRNO to a u32 instead.
This fixes a regression introduced in:
commit fd4edf197544bae1c77d84bad354aa7ce1d08ce1
Author: Hauke Mehrtens <hauke@hauke-m.de>
Date: Mon Jul 15 13:15:08 2013 +0200
bcma: fix handling of big addrl
Reported-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Tested-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma')
-rw-r--r-- | drivers/bcma/scan.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c index cd6b20fce680..37768401d113 100644 --- a/drivers/bcma/scan.c +++ b/drivers/bcma/scan.c | |||
@@ -269,6 +269,8 @@ static struct bcma_device *bcma_find_core_reverse(struct bcma_bus *bus, u16 core | |||
269 | return NULL; | 269 | return NULL; |
270 | } | 270 | } |
271 | 271 | ||
272 | #define IS_ERR_VALUE_U32(x) ((x) >= (u32)-MAX_ERRNO) | ||
273 | |||
272 | static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | 274 | static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, |
273 | struct bcma_device_id *match, int core_num, | 275 | struct bcma_device_id *match, int core_num, |
274 | struct bcma_device *core) | 276 | struct bcma_device *core) |
@@ -351,11 +353,11 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | |||
351 | * the main register space for the core | 353 | * the main register space for the core |
352 | */ | 354 | */ |
353 | tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_SLAVE, 0); | 355 | tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_SLAVE, 0); |
354 | if (tmp == 0 || IS_ERR_VALUE(tmp)) { | 356 | if (tmp == 0 || IS_ERR_VALUE_U32(tmp)) { |
355 | /* Try again to see if it is a bridge */ | 357 | /* Try again to see if it is a bridge */ |
356 | tmp = bcma_erom_get_addr_desc(bus, eromptr, | 358 | tmp = bcma_erom_get_addr_desc(bus, eromptr, |
357 | SCAN_ADDR_TYPE_BRIDGE, 0); | 359 | SCAN_ADDR_TYPE_BRIDGE, 0); |
358 | if (tmp == 0 || IS_ERR_VALUE(tmp)) { | 360 | if (tmp == 0 || IS_ERR_VALUE_U32(tmp)) { |
359 | return -EILSEQ; | 361 | return -EILSEQ; |
360 | } else { | 362 | } else { |
361 | bcma_info(bus, "Bridge found\n"); | 363 | bcma_info(bus, "Bridge found\n"); |
@@ -369,7 +371,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | |||
369 | for (j = 0; ; j++) { | 371 | for (j = 0; ; j++) { |
370 | tmp = bcma_erom_get_addr_desc(bus, eromptr, | 372 | tmp = bcma_erom_get_addr_desc(bus, eromptr, |
371 | SCAN_ADDR_TYPE_SLAVE, i); | 373 | SCAN_ADDR_TYPE_SLAVE, i); |
372 | if (IS_ERR_VALUE(tmp)) { | 374 | if (IS_ERR_VALUE_U32(tmp)) { |
373 | /* no more entries for port _i_ */ | 375 | /* no more entries for port _i_ */ |
374 | /* pr_debug("erom: slave port %d " | 376 | /* pr_debug("erom: slave port %d " |
375 | * "has %d descriptors\n", i, j); */ | 377 | * "has %d descriptors\n", i, j); */ |
@@ -386,7 +388,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | |||
386 | for (j = 0; ; j++) { | 388 | for (j = 0; ; j++) { |
387 | tmp = bcma_erom_get_addr_desc(bus, eromptr, | 389 | tmp = bcma_erom_get_addr_desc(bus, eromptr, |
388 | SCAN_ADDR_TYPE_MWRAP, i); | 390 | SCAN_ADDR_TYPE_MWRAP, i); |
389 | if (IS_ERR_VALUE(tmp)) { | 391 | if (IS_ERR_VALUE_U32(tmp)) { |
390 | /* no more entries for port _i_ */ | 392 | /* no more entries for port _i_ */ |
391 | /* pr_debug("erom: master wrapper %d " | 393 | /* pr_debug("erom: master wrapper %d " |
392 | * "has %d descriptors\n", i, j); */ | 394 | * "has %d descriptors\n", i, j); */ |
@@ -404,7 +406,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | |||
404 | for (j = 0; ; j++) { | 406 | for (j = 0; ; j++) { |
405 | tmp = bcma_erom_get_addr_desc(bus, eromptr, | 407 | tmp = bcma_erom_get_addr_desc(bus, eromptr, |
406 | SCAN_ADDR_TYPE_SWRAP, i + hack); | 408 | SCAN_ADDR_TYPE_SWRAP, i + hack); |
407 | if (IS_ERR_VALUE(tmp)) { | 409 | if (IS_ERR_VALUE_U32(tmp)) { |
408 | /* no more entries for port _i_ */ | 410 | /* no more entries for port _i_ */ |
409 | /* pr_debug("erom: master wrapper %d " | 411 | /* pr_debug("erom: master wrapper %d " |
410 | * has %d descriptors\n", i, j); */ | 412 | * has %d descriptors\n", i, j); */ |