Date: Sun, 10 Aug 2014 00:23:57 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269769 - head/sys/dev/ofw Message-ID: <53e6bb9d.27fa.94d13d8@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Sun Aug 10 00:23:57 2014 New Revision: 269769 URL: http://svnweb.freebsd.org/changeset/base/269769 Log: Use a separate variable for resource id, because 'i' may increment at a rate greater than 1 on each iteration. Modified: head/sys/dev/ofw/ofwbus.c Modified: head/sys/dev/ofw/ofwbus.c ============================================================================== --- head/sys/dev/ofw/ofwbus.c Sun Aug 10 00:03:40 2014 (r269768) +++ head/sys/dev/ofw/ofwbus.c Sun Aug 10 00:23:57 2014 (r269769) @@ -438,7 +438,7 @@ ofwbus_setup_dinfo(device_t dev, phandle uint32_t *reg, *intr, icells; uint64_t phys, size; phandle_t iparent; - int i, j; + int i, j, rid; int nintr; int nreg; @@ -467,7 +467,7 @@ ofwbus_setup_dinfo(device_t dev, phandle nreg = 0; } - for (i = 0; i < nreg; i += sc->acells + sc->scells) { + for (i = 0, rid = 0; i < nreg; i += sc->acells + sc->scells, rid++) { phys = size = 0; for (j = 0; j < sc->acells; j++) { phys <<= 32; @@ -479,7 +479,7 @@ ofwbus_setup_dinfo(device_t dev, phandle } /* Skip the dummy reg property of glue devices like ssm(4). */ if (size != 0) - resource_list_add(&ndi->ndi_rl, SYS_RES_MEMORY, i, + resource_list_add(&ndi->ndi_rl, SYS_RES_MEMORY, rid, phys, phys + size - 1, size); } free(reg, M_OFWPROP); @@ -492,10 +492,10 @@ ofwbus_setup_dinfo(device_t dev, phandle sizeof(iparent)); OF_searchencprop(OF_xref_phandle(iparent), "#interrupt-cells", &icells, sizeof(icells)); - for (i = 0; i < nintr; i+= icells) { + for (i = 0, rid = 0; i < nintr; i += icells, rid++) { intr[i] = ofw_bus_map_intr(dev, iparent, icells, &intr[i]); - resource_list_add(&ndi->ndi_rl, SYS_RES_IRQ, i, intr[i], + resource_list_add(&ndi->ndi_rl, SYS_RES_IRQ, rid, intr[i], intr[i], 1); } free(intr, M_OFWPROP);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53e6bb9d.27fa.94d13d8>