Re: [PATCH v2 1/3] mcb: Return actual parsed size when reading chameleon table

From: Johannes Thumshirn
Date: Tue Mar 28 2023 - 15:16:08 EST




Am 28.03.23 um 16:34 schrieb Rodríguez Barbarin, José Javier:
Function chameleon_parse_cells() returns the number of cells parsed

^ The function?

@@ -239,12 +240,15 @@ int chameleon_parse_cells(struct mcb_bus *bus, phys_addr_t mapbase,
num_cells++;
}
+

Stray newline.
if (num_cells == 0)
num_cells = -EINVAL;
+ table_size = p - base;
+ pr_debug("%d cell(s) found. Chameleon table size: 0x%04x bytes\n", num_cells, table_size);
kfree(cb);
kfree(header);
- return num_cells;
+ return table_size;

Ahm doesn't that need to be:
            return num_cells < 0 ? num_cells : table_size;


Otherwise we loose the -EINVAL return here.

I could've fixed up the 1st two, but the last one is a functional change and I won't fix it
up when applying.

Byte,
    Johannes