Re: [PATCH v3 19/20] platform/x86/intel/tpmi: Declare the loop counters in their loops
From: Andy Shevchenko
Date: Thu Oct 01 2026 - 14:19:57 EST
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.
--
With Best Regards,
Andy Shevchenko