Re: [PATCH v5 5/6] block: add support for partition table defined in OF

From: Christoph Hellwig
Date: Wed Oct 02 2024 - 04:43:34 EST


On Wed, Oct 02, 2024 at 12:18:57AM +0200, Christian Marangi wrote:
> +static int validate_of_partition(struct device_node *np, int slot)
> +{
> + int a_cells, s_cells;
> + const __be32 *reg;
> + u64 offset, size;
> + int len;
> +
> + reg = of_get_property(np, "reg", &len);
> +
> + a_cells = of_n_addr_cells(np);
> + s_cells = of_n_size_cells(np);

Just personal preference, but I find code easier to read if variables
are initialized at declaration time whenever possible:

const __be32 *reg = of_get_property(np, "reg", &len);
int a_cells = of_n_addr_cells(np);
int s_cells = of_n_size_cells(np);

(same for a few other functions below)

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>