Re: [PATCH v3 19/20] platform/x86/intel/tpmi: Declare the loop counters in their loops
From: Kuppuswamy Sathyanarayanan
Date: Thu Oct 01 2026 - 17:03:43 EST
Hi Andy,
On 10/1/2026 11:12 AM, Andy Shevchenko wrote:
> On Wed, Sep 30, 2026 at 10:29:16AM -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.
>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
>
> ...
>
>> - for (i = 0; i < tpmi_info->feature_count; ++i) {
>> + for (int i = 0; i < tpmi_info->feature_count; ++i) {
>
> While at it, I would also move to post-increment. The pre-increment is not so
> usual in the kernel and might rise additional question "why?".
>
> ...
>
>> - for (i = 0; i < tpmi_info->feature_count; i++) {
>> + for (int i = 0; i < tpmi_info->feature_count; i++) {
>
> Ah, we have even inconsistency in the style used for the loop iterator
> advancing.
>
Agreed. Three of the loops use pre-increment and the rest use
post-increment. I will switch them all to post-increment in this patch
in the next version.
Thanks for the review.
--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer