Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Mar 2021 16:11:08 GMT
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 622d17da46eb - main - arm64: mv_ap806_gicp: Fix spi_ranges_cnt
Message-ID:  <202103031611.123GB8xe024814@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mw:

URL: https://cgit.FreeBSD.org/src/commit/?id=622d17da46eb360c3d6847e4da8dbb166b775d14

commit 622d17da46eb360c3d6847e4da8dbb166b775d14
Author:     Zyta Szpak <zr@semihalf.com>
AuthorDate: 2021-02-19 14:31:45 +0000
Commit:     Marcin Wojtas <mw@FreeBSD.org>
CommitDate: 2021-03-03 16:08:12 +0000

    arm64: mv_ap806_gicp: Fix spi_ranges_cnt
    
    Previously the spi_ranges_cnt stored the table size in bytes
    instead of the number of elements. Fix that.
    
    Reviewed by: mmel
    Submitted by: Zyta Szpak <zr@semihalf.com>
    Obtained from: Semihalf
    Sponsored by: Marvell
---
 sys/arm/mv/mv_ap806_gicp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/arm/mv/mv_ap806_gicp.c b/sys/arm/mv/mv_ap806_gicp.c
index da93a32f2b23..0a1a69707956 100644
--- a/sys/arm/mv/mv_ap806_gicp.c
+++ b/sys/arm/mv/mv_ap806_gicp.c
@@ -107,8 +107,8 @@ mv_ap806_gicp_attach(device_t dev)
 		return (ENXIO);
 	}
 
-	sc->spi_ranges_cnt = OF_getencprop_alloc(node, "marvell,spi-ranges",
-	    (void **)&sc->spi_ranges);
+	sc->spi_ranges_cnt = OF_getencprop_alloc_multi(node, "marvell,spi-ranges",
+	    sizeof(*sc->spi_ranges), (void **)&sc->spi_ranges);
 
 	xref = OF_xref_from_node(node);
 	if (intr_pic_register(dev, xref) == NULL) {
@@ -153,7 +153,7 @@ mv_ap806_gicp_convert_map_data(struct mv_ap806_gicp_softc *sc,
 	sc->parent_map_data->cells[2] = irq_type;
 
 	/* Map the interrupt number to SPI number */
-	for (i = 0; i < sc->spi_ranges_cnt / 2; i += 2) {
+	for (i = 0; i < sc->spi_ranges_cnt; i += 2) {
 		if (irq_num < sc->spi_ranges[i + 1]) {
 			irq_num += sc->spi_ranges[i];
 			break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103031611.123GB8xe024814>