Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Apr 2024 22:48:57 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d0cc25f770ae - main - acpi_cmbat: Use nitems instead of sizeof
Message-ID:  <202404192248.43JMmvxl010898@gitrepo.freebsd.org>

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

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

commit d0cc25f770aee068bcbaee89aa2f52cc5dd79dd5
Author:     Ahmad Khalifa <ahmadkhalifa570@gmail.com>
AuthorDate: 2024-04-19 22:43:19 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-04-19 22:44:57 +0000

    acpi_cmbat: Use nitems instead of sizeof
    
    Reviewed by: imp, markj, Elliott Mitchell
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1125
---
 sys/dev/acpica/acpi_cmbat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/dev/acpica/acpi_cmbat.c b/sys/dev/acpica/acpi_cmbat.c
index 8c08868456d7..aeda34c3acff 100644
--- a/sys/dev/acpica/acpi_cmbat.c
+++ b/sys/dev/acpica/acpi_cmbat.c
@@ -344,7 +344,7 @@ acpi_cmbat_get_bix(void *arg)
     bix_buffer.Pointer = NULL;
     bix_buffer.Length = ACPI_ALLOCATE_BUFFER;
 
-    for (n = 0; n < sizeof(bobjs); n++) {
+    for (n = 0; n < nitems(bobjs); n++) {
 	as = AcpiEvaluateObject(h, bobjs[n].name, NULL, &bix_buffer);
 	if (!ACPI_FAILURE(as)) {
 	    res = (ACPI_OBJECT *)bix_buffer.Pointer;
@@ -355,7 +355,7 @@ acpi_cmbat_get_bix(void *arg)
         bix_buffer.Length = ACPI_ALLOCATE_BUFFER;
     }
     /* Both _BIF and _BIX were not found. */
-    if (n == sizeof(bobjs)) {
+    if (n == nitems(bobjs)) {
 	ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
 	    "error fetching current battery info -- %s\n",
 	    AcpiFormatException(as));



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