Skip to content

Commit

Permalink
ASoC: da7219-aad: fix usage of device_get_named_child_node()
Browse files Browse the repository at this point in the history
The documentation for device_get_named_child_node() mentions this
important point:

"
The caller is responsible for calling fwnode_handle_put() on the
returned fwnode pointer.
"

Add fwnode_handle_put() to avoid a leaked reference.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240426153033.38500-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Pierre-Louis Bossart authored and Mark Brown committed Apr 29, 2024
1 parent 6db26f9 commit e8a6a5a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sound/soc/codecs/da7219-aad.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,10 @@ static struct da7219_aad_pdata *da7219_aad_fw_to_pdata(struct device *dev)
return NULL;

aad_pdata = devm_kzalloc(dev, sizeof(*aad_pdata), GFP_KERNEL);
if (!aad_pdata)
if (!aad_pdata) {
fwnode_handle_put(aad_np);
return NULL;
}

aad_pdata->irq = i2c->irq;

Expand Down Expand Up @@ -753,6 +755,8 @@ static struct da7219_aad_pdata *da7219_aad_fw_to_pdata(struct device *dev)
else
aad_pdata->adc_1bit_rpt = DA7219_AAD_ADC_1BIT_RPT_1;

fwnode_handle_put(aad_np);

return aad_pdata;
}

Expand Down

0 comments on commit e8a6a5a

Please sign in to comment.