diff mbox series

ASoC: loongson: fix error release

Message ID 20240903090620.6276-1-tangbin@cmss.chinamobile.com (mailing list archive)
State Accepted
Commit 97688a9c5b1fd2b826c682cdfa36d411a5c99828
Headers show
Series ASoC: loongson: fix error release | expand

Commit Message

Tang Bin Sept. 3, 2024, 9:06 a.m. UTC
In function loongson_card_parse_of(), when get device_node
'codec' failed, the function of_node_put(codec) should not
be invoked, thus fix error release.

Fixes: d24028606e76 ("ASoC: loongson: Add Loongson ASoC Sound Card Support")
Signed-off-by: tangbin <tangbin@cmss.chinamobile.com>
---
 sound/soc/loongson/loongson_card.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mark Brown Sept. 3, 2024, 10:50 p.m. UTC | #1
On Tue, 03 Sep 2024 17:06:20 +0800, tangbin wrote:
> In function loongson_card_parse_of(), when get device_node
> 'codec' failed, the function of_node_put(codec) should not
> be invoked, thus fix error release.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: loongson: fix error release
      commit: 97688a9c5b1fd2b826c682cdfa36d411a5c99828

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Markus Elfring Sept. 8, 2024, 4:32 p.m. UTC | #2
> In function loongson_card_parse_of(), when get device_node

                                                 device node?


> 'codec' failed, the function of_node_put(codec) should not
> be invoked, thus fix error release.

                       exception handling?

How do you think about to increase the application of scope-based resource management?


…
> Signed-off-by: tangbin <tangbin@cmss.chinamobile.com>

Is an other personal name preferred here according to the Developer's Certificate of Origin?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.11-rc6#n396

Regards,
Markus
diff mbox series

Patch

diff --git a/sound/soc/loongson/loongson_card.c b/sound/soc/loongson/loongson_card.c
index fae5e9312..2c8dbdba2 100644
--- a/sound/soc/loongson/loongson_card.c
+++ b/sound/soc/loongson/loongson_card.c
@@ -127,8 +127,8 @@  static int loongson_card_parse_of(struct loongson_card_data *data)
 	codec = of_get_child_by_name(dev->of_node, "codec");
 	if (!codec) {
 		dev_err(dev, "audio-codec property missing or invalid\n");
-		ret = -EINVAL;
-		goto err;
+		of_node_put(cpu);
+		return -EINVAL;
 	}
 
 	for (i = 0; i < card->num_links; i++) {