diff options
author | Oleksandr Tymoshenko <gonzo@FreeBSD.org> | 2018-03-20 00:03:49 +0000 |
---|---|---|
committer | Oleksandr Tymoshenko <gonzo@FreeBSD.org> | 2018-03-20 00:03:49 +0000 |
commit | 108117cc22335234f817584a42704258209ca78c (patch) | |
tree | 35821278566f932eed35ee949df3ea3e14a796a3 /sys/arm/freescale | |
parent | 5f5baf0e9697eea27a5a8e77fbdb639397f7f388 (diff) | |
download | src-108117cc22335234f817584a42704258209ca78c.tar.gz src-108117cc22335234f817584a42704258209ca78c.zip |
[ofw] fix errneous checks for OF_finddevice(9) return value
OF_finddevices returns ((phandle_t)-1) in case of failure. Some code
in existing drivers checked return value to be equal to 0 or
less/equal to 0 which is also wrong because phandle_t is unsigned
type. Most of these checks were for negative cases that were never
triggered so trhere was no impact on functionality.
Reviewed by: nwhitehorn
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D14645
Notes
Notes:
svn path=/head/; revision=331229
Diffstat (limited to 'sys/arm/freescale')
-rw-r--r-- | sys/arm/freescale/fsl_ocotp.c | 2 | ||||
-rw-r--r-- | sys/arm/freescale/vybrid/vf_machdep.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/arm/freescale/fsl_ocotp.c b/sys/arm/freescale/fsl_ocotp.c index 9a0f9b4ec62f..6b64686f7869 100644 --- a/sys/arm/freescale/fsl_ocotp.c +++ b/sys/arm/freescale/fsl_ocotp.c @@ -72,7 +72,7 @@ fsl_ocotp_devmap(void) phandle_t child, root; u_long base, size; - if ((root = OF_finddevice("/")) == 0) + if ((root = OF_finddevice("/")) == -1) goto fatal; if ((child = fdt_depth_search_compatible(root, "fsl,imx6q-ocotp", 0)) == 0) goto fatal; diff --git a/sys/arm/freescale/vybrid/vf_machdep.c b/sys/arm/freescale/vybrid/vf_machdep.c index bc8e679321f3..6c5b7bcf3755 100644 --- a/sys/arm/freescale/vybrid/vf_machdep.c +++ b/sys/arm/freescale/vybrid/vf_machdep.c @@ -68,7 +68,7 @@ vf_cpu_reset(platform_t plat) goto end; src = OF_finddevice("src"); - if ((src != 0) && (OF_getencprop(src, "reg", &paddr, sizeof(paddr))) > 0) { + if ((src != -1) && (OF_getencprop(src, "reg", &paddr, sizeof(paddr))) > 0) { if (bus_space_map(fdtbus_bs_tag, paddr, 0x10, 0, &vaddr) == 0) { bus_space_write_4(fdtbus_bs_tag, vaddr, 0x00, SW_RST); } |