Re: [PATCH v3 14/20] platform/x86/intel/tpmi: Use scope based cleanup in the memory dump
From: Kuppuswamy Sathyanarayanan
Date: Thu Oct 01 2026 - 14:19:17 EST
Hi Andy,
On 10/1/2026 11:06 AM, Andy Shevchenko wrote:
> On Wed, Sep 30, 2026 at 10:29:11AM -0700, Kuppuswamy Sathyanarayanan wrote:
>> tpmi_mem_dump_show() frees its dump buffer and drops tpmi_dev_lock by
>> hand at the end of the function, so the ioremap() failure in the middle
>> of the loop cannot just return. It breaks out with an error stashed in
>> ret, which is the only reason ret exists.
>>
>> Attach the buffer to __free(kfree) at its allocation and take the mutex
>> with guard(), then return the error directly from the loop. mem_write()
>> in this file already does both, so this makes the two debugfs paths
>> consistent.
>>
>> No functional change intended.
>
> I assume that file already includes cleanup.h? Otherwise needs to be added.
Yes, it does. tpmi_common.c already includes <linux/cleanup.h>.
> With that in mind,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
>
Thanks for the review.
--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer