]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hwmon: (max6697) fix regmap leak on probe failure
authorJohan Hovold <johan@kernel.org>
Thu, 27 Nov 2025 13:43:51 +0000 (14:43 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 27 Nov 2025 16:08:25 +0000 (08:08 -0800)
The i2c regmap allocated during probe is never freed.

Switch to using the device managed allocator so that the regmap is
released on probe failures (e.g. probe deferral) and on driver unbind.

Fixes: 3a2a8cc3fe24 ("hwmon: (max6697) Convert to use regmap")
Cc: stable@vger.kernel.org # 6.12
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20251127134351.1585-1-johan@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/max6697.c

index 6b4a528388184c509e9c97b0e81705b0a78a7b67..dd906cf491cae79e8307728c37cff8848b2638aa 100644 (file)
@@ -542,7 +542,7 @@ static int max6697_probe(struct i2c_client *client)
        struct regmap *regmap;
        int err;
 
-       regmap = regmap_init_i2c(client, &max6697_regmap_config);
+       regmap = devm_regmap_init_i2c(client, &max6697_regmap_config);
        if (IS_ERR(regmap))
                return PTR_ERR(regmap);