summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/powermac
diff options
context:
space:
mode:
authorjchandra <jchandra@FreeBSD.org>2011-12-02 15:24:39 +0000
committerjchandra <jchandra@FreeBSD.org>2011-12-02 15:24:39 +0000
commite5b89f2d70c0092ae178473393348aa3de7e2745 (patch)
tree282cdd7ec20de7056adfd64b8aed0bd16d32eb50 /sys/powerpc/powermac
parent9be1bfa322fff9a906d73bb1d09940d86d489415 (diff)
downloadFreeBSD-src-e5b89f2d70c0092ae178473393348aa3de7e2745.zip
FreeBSD-src-e5b89f2d70c0092ae178473393348aa3de7e2745.tar.gz
Fix OF_finddevice error return value in case of FDT.
According to the open firmware standard, finddevice call has to return a phandle with value of -1 in case of error. This commit is to: - Fix the FDT implementation of this interface (ofw_fdt_finddevice) to return (phandle_t)-1 in case of error, instead of 0 as it does now. - Fix up the callers of OF_finddevice() to compare the return value with -1 instead of 0 to check for errors. - Since phandle_t is unsigned, the return value of OF_finddevice should be checked with '== -1' rather than '<= 0' or '> 0', fix up these cases as well. Reported by: nwhitehorn Reviewed by: raj Approved by: raj, nwhitehorn
Diffstat (limited to 'sys/powerpc/powermac')
-rw-r--r--sys/powerpc/powermac/platform_powermac.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/powerpc/powermac/platform_powermac.c b/sys/powerpc/powermac/platform_powermac.c
index d495065..978b33a 100644
--- a/sys/powerpc/powermac/platform_powermac.c
+++ b/sys/powerpc/powermac/platform_powermac.c
@@ -163,7 +163,7 @@ powermac_smp_first_cpu(platform_t plat, struct cpuref *cpuref)
* but it can be found directly
*/
dev = OF_finddevice("/cpus");
- if (dev == 0)
+ if (dev == -1)
return (ENOENT);
}
@@ -209,7 +209,7 @@ powermac_smp_get_bsp(platform_t plat, struct cpuref *cpuref)
int res;
chosen = OF_finddevice("/chosen");
- if (chosen == 0)
+ if (chosen == -1)
return (ENXIO);
res = OF_getprop(chosen, "cpu", &inst, sizeof(inst));
OpenPOWER on IntegriCloud