Re: [PATCH v2 18/19] platform/x86/intel/tpmi: Declare the loop counters in their loops
From: Kuppuswamy Sathyanarayanan
Date: Fri Sep 25 2026 - 13:56:01 EST
Hi,
On 9/24/2026 2:17 PM, Andy Shevchenko wrote:
> 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.
Sure. will do it in v3.
>
--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer