Re: [PATCH v3 1/2] hwmon: (lenovo-ec-sensors): Convert to devm_request_region()
From: Guenter Roeck
Date: Thu May 21 2026 - 10:18:37 EST
On Thu, May 21, 2026 at 11:52:27AM +0800, Kean Ren wrote:
> Replace manual request_region()/release_region() with
> devm_request_region(). This lets the device-managed framework
> handle I/O region lifetime automatically and fixes:
>
> - A double release_region() when probe fails after acquiring the
> I/O region: the probe error path releases it, and then
> lenovo_ec_init() releases it again on the same error path.
>
> - A release-after-use window in lenovo_ec_exit() where
> release_region() was called before platform_device_unregister(),
> leaving the hwmon device active with a released I/O region.
>
> - Missing release_region() in lenovo_ec_probe() if
> devm_hwmon_device_register_with_info() fails.
>
> Remove all four manual release_region() calls that are now handled
> automatically and replace request_region with
> devm_request_region, use dev_err replace pr_err.
>
> Also remove the now-unnecessary braces around the single-statement
> if body.
>
> Reviewed-by: Mark Pearson <mpearson-lenovo@xxxxxxxxx>
> Signed-off-by: Kean Ren <rh_king@xxxxxxx>
Applied.
Thanks,
Guenter