patch "iio: dac: ad5770r: Put fwnode in error case during ->probe()" added to staging-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
iio: dac: ad5770r: Put fwnode in error case during ->probe()
to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-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 98b7b0ca0828907dbb706387c11356a45463e2ea Mon Sep 17 00:00:00 2001
From: Andy Shevchenko <[email protected]>
Date: Mon, 10 May 2021 12:56:49 +0300
Subject: iio: dac: ad5770r: Put fwnode in error case during ->probe()
device_for_each_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller.
--- drivers/iio/dac/ad5770r.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/iio/dac/ad5770r.c +11 -5
@@ -524,23 +524,29 @@ static int ad5770r_channel_config(struct ad5770r_state *st)device_for_each_child_node (&st->spi->dev, child) { ret =fwnode_property_read_u32 (child,"num" , &num);if (ret) -return ret; -if (num >=AD5770R_MAX_CHANNELS ) -return -EINVAL ; + goto err_child_out; +if (num >=AD5770R_MAX_CHANNELS ) { + ret = -EINVAL ; + goto err_child_out; + } ret =fwnode_property_read_u32_array (child,"adi,range-microamp" , tmp,2 );if (ret) -return ret; + goto err_child_out; min = tmp[0 ] /1000 ; max = tmp[1 ] /1000 ; ret =ad5770r_store_output_range (st, min, max, num);if (ret) -return ret; + goto err_child_out; } +return 0 ; + +err_child_out: +fwnode_handle_put (child);return ret; }
Signature · 1 line
2.31.1