Re: [PATCH] iio: light: veml6070: Fix resource leak in probe error path
From: Andy Shevchenko
Date: Thu Mar 26 2026 - 14:40:59 EST
On Thu, Mar 26, 2026 at 08:11:42PM +0800, Felix Gu wrote:
> The original code registered the i2c dummy device cleanup via
> devm_add_action_or_reset() after i2c_new_dummy_device(). If probe
> failed between these two calls, the dummy device would leak.
I see what you meant by reading the code, but the above is simply wrong.
The
ret = i2c_new_dummy_device();
if (ret)
return ret; // "probe failed between these two calls"
ret = devm_add_action_or_reset();
Please, rephrase.
> Use devm_i2c_new_dummy_device() which registers cleanup atomically
> with device creation, eliminating the error-path window.
With the fixed commit message
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
--
With Best Regards,
Andy Shevchenko