Skip to content

Commit e8a6a5a

Browse files
plbossartbroonie
authored andcommitted
ASoC: da7219-aad: fix usage of device_get_named_child_node()
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>
1 parent 6db26f9 commit e8a6a5a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sound/soc/codecs/da7219-aad.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,10 @@ static struct da7219_aad_pdata *da7219_aad_fw_to_pdata(struct device *dev)
671671
return NULL;
672672

673673
aad_pdata = devm_kzalloc(dev, sizeof(*aad_pdata), GFP_KERNEL);
674-
if (!aad_pdata)
674+
if (!aad_pdata) {
675+
fwnode_handle_put(aad_np);
675676
return NULL;
677+
}
676678

677679
aad_pdata->irq = i2c->irq;
678680

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

758+
fwnode_handle_put(aad_np);
759+
756760
return aad_pdata;
757761
}
758762

0 commit comments

Comments
 (0)