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 fd4edf1975
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>
This commit is contained in:
committed by
John W. Linville
parent
8a10da2646
commit
aaa2ced15a
@@ -269,6 +269,8 @@ static struct bcma_device *bcma_find_core_reverse(struct bcma_bus *bus, u16 core
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define IS_ERR_VALUE_U32(x) ((x) >= (u32)-MAX_ERRNO)
|
||||||
|
|
||||||
static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
|
static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
|
||||||
struct bcma_device_id *match, int core_num,
|
struct bcma_device_id *match, int core_num,
|
||||||
struct bcma_device *core)
|
struct bcma_device *core)
|
||||||
@@ -351,11 +353,11 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
|
|||||||
* the main register space for the core
|
* the main register space for the core
|
||||||
*/
|
*/
|
||||||
tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_SLAVE, 0);
|
tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_SLAVE, 0);
|
||||||
if (tmp == 0 || IS_ERR_VALUE(tmp)) {
|
if (tmp == 0 || IS_ERR_VALUE_U32(tmp)) {
|
||||||
/* Try again to see if it is a bridge */
|
/* Try again to see if it is a bridge */
|
||||||
tmp = bcma_erom_get_addr_desc(bus, eromptr,
|
tmp = bcma_erom_get_addr_desc(bus, eromptr,
|
||||||
SCAN_ADDR_TYPE_BRIDGE, 0);
|
SCAN_ADDR_TYPE_BRIDGE, 0);
|
||||||
if (tmp == 0 || IS_ERR_VALUE(tmp)) {
|
if (tmp == 0 || IS_ERR_VALUE_U32(tmp)) {
|
||||||
return -EILSEQ;
|
return -EILSEQ;
|
||||||
} else {
|
} else {
|
||||||
bcma_info(bus, "Bridge found\n");
|
bcma_info(bus, "Bridge found\n");
|
||||||
@@ -369,7 +371,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
|
|||||||
for (j = 0; ; j++) {
|
for (j = 0; ; j++) {
|
||||||
tmp = bcma_erom_get_addr_desc(bus, eromptr,
|
tmp = bcma_erom_get_addr_desc(bus, eromptr,
|
||||||
SCAN_ADDR_TYPE_SLAVE, i);
|
SCAN_ADDR_TYPE_SLAVE, i);
|
||||||
if (IS_ERR_VALUE(tmp)) {
|
if (IS_ERR_VALUE_U32(tmp)) {
|
||||||
/* no more entries for port _i_ */
|
/* no more entries for port _i_ */
|
||||||
/* pr_debug("erom: slave port %d "
|
/* pr_debug("erom: slave port %d "
|
||||||
* "has %d descriptors\n", i, j); */
|
* "has %d descriptors\n", i, j); */
|
||||||
@@ -386,7 +388,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
|
|||||||
for (j = 0; ; j++) {
|
for (j = 0; ; j++) {
|
||||||
tmp = bcma_erom_get_addr_desc(bus, eromptr,
|
tmp = bcma_erom_get_addr_desc(bus, eromptr,
|
||||||
SCAN_ADDR_TYPE_MWRAP, i);
|
SCAN_ADDR_TYPE_MWRAP, i);
|
||||||
if (IS_ERR_VALUE(tmp)) {
|
if (IS_ERR_VALUE_U32(tmp)) {
|
||||||
/* no more entries for port _i_ */
|
/* no more entries for port _i_ */
|
||||||
/* pr_debug("erom: master wrapper %d "
|
/* pr_debug("erom: master wrapper %d "
|
||||||
* "has %d descriptors\n", i, j); */
|
* "has %d descriptors\n", i, j); */
|
||||||
@@ -404,7 +406,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
|
|||||||
for (j = 0; ; j++) {
|
for (j = 0; ; j++) {
|
||||||
tmp = bcma_erom_get_addr_desc(bus, eromptr,
|
tmp = bcma_erom_get_addr_desc(bus, eromptr,
|
||||||
SCAN_ADDR_TYPE_SWRAP, i + hack);
|
SCAN_ADDR_TYPE_SWRAP, i + hack);
|
||||||
if (IS_ERR_VALUE(tmp)) {
|
if (IS_ERR_VALUE_U32(tmp)) {
|
||||||
/* no more entries for port _i_ */
|
/* no more entries for port _i_ */
|
||||||
/* pr_debug("erom: master wrapper %d "
|
/* pr_debug("erom: master wrapper %d "
|
||||||
* has %d descriptors\n", i, j); */
|
* has %d descriptors\n", i, j); */
|
||||||
|
Reference in New Issue
Block a user