patch "iio: light: veml6070: Fix resource leak in probe error path" added to char-misc-linus
Subsystems (2)
This is a note to let you know that I've just added the patch titled
iio: light: veml6070: Fix resource leak in probe error path
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From b66f922f6a4fa92840f662fbcfeb4f8a0f774bcc Mon Sep 17 00:00:00 2001
From: Felix Gu <[email protected]>
Date: Fri, 27 Mar 2026 20:27:54 +0800
Subject: iio: light: veml6070: Fix resource leak in probe error path
The driver calls i2c_new_dummy_device() to create a dummy device, then calls i2c_smbus_write_byte(). If i2c_smbus_write_byte() fails and returns, the cleanup via devm_add_action_or_reset() was never registered, so the dummy device leaks.
Switch to devm_i2c_new_dummy_device() which registers cleanup atomically with device creation, eliminating the error-path window.
--- drivers/iio/light/veml6070.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/iio/light/veml6070.c +2 -12
@@ -245,13 +245,6 @@ static const struct iio_info veml6070_info = { .write_raw = veml6070_write_raw, }; -static void veml6070_i2c_unreg (void *p) -{ -struct veml6070_data *data = p; - -i2c_unregister_device (data->client2); -} -static int veml6070_probe (struct i2c_client *client) {struct veml6070_data *data;
@@ -281,7 +274,8 @@ static int veml6070_probe(struct i2c_client *client)if (ret <0 )return ret; - data->client2 =i2c_new_dummy_device (client->adapter,VEML6070_ADDR_DATA_LSB ); + data->client2 =devm_i2c_new_dummy_device (&client->dev, client->adapter, +VEML6070_ADDR_DATA_LSB );if (IS_ERR (data->client2))return dev_err_probe (&client->dev,PTR_ERR (data->client2),"i2c device for second chip address failed\n" );
@@ -292,10 +286,6 @@ static int veml6070_probe(struct i2c_client *client)if (ret <0 )return ret; - ret =devm_add_action_or_reset (&client->dev, veml6070_i2c_unreg, data); -if (ret <0 ) -return ret; -return devm_iio_device_register (&client->dev, indio_dev); }
Signature · 1 line
2.54.0