Messages in this thread | | | Date | Fri, 4 Aug 2023 09:00:45 +0300 | From | Andy Shevchenko <> | Subject | Re: [RFC PATCH v1 08/21] RISC-V: ACPI: RHCT: Add function to get CBO block sizes |
| |
On Thu, Aug 03, 2023 at 11:29:03PM +0530, Sunil V L wrote: > CBO related block size in ACPI is provided by RHCT. Add > support to read the CMO node in RHCT to get this information.
...
> + if (!table) {
Why not positive conditional?
> + rhct = (struct acpi_table_rhct *)acpi_get_rhct(); > + if (!rhct) > + return -ENOENT; > + } else { > + rhct = (struct acpi_table_rhct *)table; > + }
...
> + end = ACPI_ADD_PTR(struct acpi_rhct_node_header, rhct, rhct->header.length);
> +
Blank line here is not needed.
> + for (node = ACPI_ADD_PTR(struct acpi_rhct_node_header, rhct, rhct->node_offset); > + node < end; > + node = ACPI_ADD_PTR(struct acpi_rhct_node_header, node, node->length)) {
> + for (int i = 0; i < hart_info->num_offsets; i++) { > + ref_node = ACPI_ADD_PTR(struct acpi_rhct_node_header, > + rhct, hart_info_node_offset[i]); > + if (ref_node->type == ACPI_RHCT_NODE_TYPE_CMO) { > + cmo_node = ACPI_ADD_PTR(struct acpi_rhct_cmo_node, > + ref_node, size_hdr); > + if (cbom_size) > + *cbom_size = 1 << cmo_node->cbom_size; > + > + if (cboz_size) > + *cboz_size = 1 << cmo_node->cboz_size; > + > + if (cbop_size) > + *cbop_size = 1 << cmo_node->cbop_size;
BIT() in all three cases?
But how you guarantee it will not overflow? I mean who prevents cboX_size to be bigger than 30 (note also that 31 in your case is Undefined Behaviour in accordance with the C standard).
> + return 0; > + } > + }
> + }
-- With Best Regards, Andy Shevchenko
| |