From owner-svn-src-all@FreeBSD.ORG Sun Aug 10 00:23:58 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A03581F for ; Sun, 10 Aug 2014 00:23:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10FC42B3A for ; Sun, 10 Aug 2014 00:23:58 +0000 (UTC) Received: from ian (uid 1311) (envelope-from ian@FreeBSD.org) id 27fa by svn.freebsd.org (DragonFly Mail Agent v0.9+); Sun, 10 Aug 2014 00:23:57 +0000 From: Ian Lepore Date: Sun, 10 Aug 2014 00:23:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269769 - head/sys/dev/ofw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e6bb9d.27fa.94d13d8@svn.freebsd.org> X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Aug 2014 00:23:58 -0000 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);