Re: [PATCH v3 14/20] platform/x86/intel/tpmi: Use scope based cleanup in the memory dump
From: Andy Shevchenko
Date: Thu Oct 01 2026 - 14:07:00 EST
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.
With that in mind,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
--
With Best Regards,
Andy Shevchenko