Hmm, there was a confusion for my side.

This bug affected cases where

(1) index >= 1 is explicitly specified for
fdtbus_powerdomain_enable_index(),

as well as

(2) all indices are implicitly specified by
fdtbus_powerdomain_enable().

s/enable/disable/ functions were affected also.

Thanks,
rin

On 2024/06/12 15:39, Rin Okuyama wrote:
Module Name:    src
Committed By:   rin
Date:           Wed Jun 12 06:39:28 UTC 2024

Modified Files:
        src/sys/dev/fdt: fdt_powerdomain.c

Log Message:
fdt_powerdomain: Fix bug by which pd index >= 1 couldn't be enabled

Length in bytes was mistakenly used as number of uint32_t variables.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_powerdomain.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.


Modified files:

Index: src/sys/dev/fdt/fdt_powerdomain.c
diff -u src/sys/dev/fdt/fdt_powerdomain.c:1.1 
src/sys/dev/fdt/fdt_powerdomain.c:1.2
--- src/sys/dev/fdt/fdt_powerdomain.c:1.1       Fri Mar  4 08:19:06 2022
+++ src/sys/dev/fdt/fdt_powerdomain.c   Wed Jun 12 06:39:28 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_powerdomain.c,v 1.1 2022/03/04 08:19:06 skrll Exp $ */
+/* $NetBSD: fdt_powerdomain.c,v 1.2 2024/06/12 06:39:28 rin Exp $ */
/*-
   * Copyright (c) 2022 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
   */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_powerdomain.c,v 1.1 2022/03/04 08:19:06 skrll Exp 
$");
+__KERNEL_RCSID(0, "$NetBSD: fdt_powerdomain.c,v 1.2 2024/06/12 06:39:28 rin Exp 
$");
#include <sys/param.h> @@ -103,7 +103,7 @@ fdtbus_powerdomain_enable_internal(int p
        if (pds == NULL)
                return EINVAL;
- for (const uint32_t *pd = pds; pd < pds + len; index--) {
+       for (const uint32_t *pd = pds; pd < pds + len / sizeof(*pd); index--) {
                uint32_t pd_node =
                   fdtbus_get_phandle_from_native(be32toh(pd[0]));
                struct fdtbus_powerdomain_controller *pdc =

Reply via email to