From: Xiang W <wxjstz@126.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v2 3/6] lib: fix fdt_parse_plmt_node()
Date: Mon, 28 Nov 2022 20:52:14 +0800 [thread overview]
Message-ID: <29fdc1fc5a5bf663ba7daa95757b2afbb71ab39d.camel@126.com> (raw)
In-Reply-To: <20221128091420.30391-4-heinrich.schuchardt@canonical.com>
? 2022-11-28???? 10:14 +0100?Heinrich Schuchardt???
> cpu_offset, cpu_intc_offset must be int to discover failed invocations of
> fdt_node_offset_by_phandle() or fdt_parent_offset().
>
> After determining cpu_offset we have to check this value and not
> cpu_intc_offset.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Look good to me
Reviewed-by: Xiang W <wxjstz@126.com>
> ---
> v2:
> ????????check correct variable
> ---
> ?lib/utils/fdt/fdt_helper.c | 6 ++++--
> ?1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lib/utils/fdt/fdt_helper.c b/lib/utils/fdt/fdt_helper.c
> index 87b9fb2..976c96e 100644
> --- a/lib/utils/fdt/fdt_helper.c
> +++ b/lib/utils/fdt/fdt_helper.c
> @@ -805,7 +805,7 @@ int fdt_parse_plmt_node(void *fdt, int nodeoffset, unsigned long *plmt_base,
> ?{
> ????????const fdt32_t *val;
> ????????int rc, i, count;
> -???????uint64_t reg_addr, reg_size, cpu_offset, cpu_intc_offset;
> +???????uint64_t reg_addr, reg_size;
> ????????u32 phandle, hwirq, hartid, hcount;
> ?
> ????????if (nodeoffset < 0 || !fdt || !plmt_base ||
> @@ -826,6 +826,8 @@ int fdt_parse_plmt_node(void *fdt, int nodeoffset, unsigned long *plmt_base,
> ?
> ????????hcount = 0;
> ????????for (i = 0; i < (count / 2); i++) {
> +???????????????int cpu_offset, cpu_intc_offset;
> +
> ????????????????phandle = fdt32_to_cpu(val[2 * i]);
> ????????????????hwirq = fdt32_to_cpu(val[2 * i + 1]);
> ?
> @@ -834,7 +836,7 @@ int fdt_parse_plmt_node(void *fdt, int nodeoffset, unsigned long *plmt_base,
> ????????????????????????continue;
> ?
> ????????????????cpu_offset = fdt_parent_offset(fdt, cpu_intc_offset);
> -???????????????if (cpu_intc_offset < 0)
> +???????????????if (cpu_offset < 0)
> ????????????????????????continue;
> ?
> ????????????????rc = fdt_parse_hart_id(fdt, cpu_offset, &hartid);
next prev parent reply other threads:[~2022-11-28 12:52 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 9:14 [PATCH v2 0/6] lib: fixes for fdt functions Heinrich Schuchardt
2022-11-28 9:14 ` [PATCH v2 1/6] lib: simplify fdt_parse_plmt_node() Heinrich Schuchardt
2022-12-02 15:55 ` Bin Meng
2022-11-28 9:14 ` [PATCH v2 2/6] lib: simplify fdt_parse_plicsw_node() Heinrich Schuchardt
2022-12-02 15:55 ` Bin Meng
2022-11-28 9:14 ` [PATCH v2 3/6] lib: fix fdt_parse_plmt_node() Heinrich Schuchardt
2022-11-28 12:52 ` Xiang W [this message]
2022-11-28 12:52 ` Xiang W
2022-11-29 10:42 ` Yu-Chien Peter Lin
2022-12-02 15:55 ` Bin Meng
2022-11-28 9:14 ` [PATCH v2 4/6] lib: fix fdt_parse_plicsw_node() Heinrich Schuchardt
2022-11-28 12:53 ` Xiang W
2022-11-28 12:53 ` Xiang W
2022-11-29 10:44 ` Yu-Chien Peter Lin
2022-12-02 15:55 ` Bin Meng
2022-11-28 9:14 ` [PATCH v2 5/6] lib: simplify fdt_translate_address() Heinrich Schuchardt
2022-12-02 15:55 ` Bin Meng
2022-11-28 9:14 ` [PATCH v2 6/6] lib: fix fdt_parse_aclint_node() Heinrich Schuchardt
2022-11-28 12:54 ` Xiang W
2022-11-28 12:54 ` Xiang W
2022-12-02 15:55 ` Bin Meng
2022-12-05 5:15 ` [PATCH v2 0/6] lib: fixes for fdt functions Anup Patel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=29fdc1fc5a5bf663ba7daa95757b2afbb71ab39d.camel@126.com \
--to=wxjstz@126.com \
--cc=opensbi@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.