Re: [PATCH v2 18/19] platform/x86/intel/tpmi: Declare the loop counters in their loops

From: Andy Shevchenko

Date: Thu Sep 24 2026 - 17:17:42 EST


On Thu, Sep 24, 2026 at 11:23:40AM -0700, Kuppuswamy Sathyanarayanan wrote:
> Declare the loop counters in the for statements that use them, so that
> they are scoped to their loops.
>
> In tpmi_create_device() this also replaces the tmp cursor, which moved
> in step with the counter, with res[i].
>
> No functional change intended.

...

> - for (i = 0, tmp = res; i < pfs->pfs_header.num_entries; i++, tmp++) {
> + for (int i = 0; i < pfs->pfs_header.num_entries; i++) {
> u64 entry_size_bytes = pfs->pfs_header.entry_size * sizeof(u32);
>
> - tmp->start = pfs->vsec_offset + entry_size_bytes * i;
> - tmp->end = tmp->start + entry_size_bytes - 1;
> - tmp->flags = IORESOURCE_MEM;
> + res[i].start = pfs->vsec_offset + entry_size_bytes * i;
> + res[i].end = res[i].start + entry_size_bytes - 1;
> + res[i].flags = IORESOURCE_MEM;

This should really use DEFINE_RES_MEM() instead.

> }

...

The rest is fine. So, make a prerequisite patch and rebase this one on top.

--
With Best Regards,
Andy Shevchenko