Loading
hwmon: (lenovo-ec-sensors): Convert to devm_request_region()
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. Fixes: 70118f85 ("hwmon: Add EC Chip driver for Lenovo ThinkStation motherboards") Reviewed-by:Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by:
Kean Ren <rh_king@163.com> Link: https://lore.kernel.org/r/20260521035228.533317-2-rh_king@163.com Signed-off-by:
Guenter Roeck <linux@roeck-us.net>