@@ -825,7 +825,7 @@ static int adc5_get_fw_data(struct adc5_chip *adc)
const struct adc5_channels *adc_chan;
struct iio_chan_spec *iio_chan;
struct adc5_channel_prop prop, *chan_props;
- struct fwnode_handle *child;
+ struct fwnode_handle *child __free(fwnode_handle) = NULL;
unsigned int index = 0;
int ret;
@@ -851,10 +851,8 @@ static int adc5_get_fw_data(struct adc5_chip *adc)
device_for_each_child_node(adc->dev, child) {
ret = adc5_get_fw_channel_data(adc, &prop, child, adc->data);
- if (ret) {
- fwnode_handle_put(child);
+ if (ret)
return ret;
- }
prop.scale_fn_type =
adc->data->adc_chans[prop.channel].scale_fn_type;