Commit 7d996c8a authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Mark Brown

ASoC: simple-card: Use cleanup.h instead of devm_kfree()

Allocate the memory with scoped/cleanup.h, instead of devm interface, to
make the code more obvious that memory is not used outside this scope.
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/20240703-asoc-cleanup-h-v1-8-71219dfd0aef@linaro.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent b39f7713
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
// Copyright (C) 2012 Renesas Solutions Corp. // Copyright (C) 2012 Renesas Solutions Corp.
// Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> // Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
#include <linux/cleanup.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -727,7 +728,6 @@ static int simple_probe(struct platform_device *pdev) ...@@ -727,7 +728,6 @@ static int simple_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node; struct device_node *np = dev->of_node;
struct snd_soc_card *card; struct snd_soc_card *card;
struct link_info *li;
int ret; int ret;
/* Allocate the private data and the DAI link array */ /* Allocate the private data and the DAI link array */
...@@ -741,7 +741,7 @@ static int simple_probe(struct platform_device *pdev) ...@@ -741,7 +741,7 @@ static int simple_probe(struct platform_device *pdev)
card->probe = simple_soc_probe; card->probe = simple_soc_probe;
card->driver_name = "simple-card"; card->driver_name = "simple-card";
li = devm_kzalloc(dev, sizeof(*li), GFP_KERNEL); struct link_info *li __free(kfree) = kzalloc(sizeof(*li), GFP_KERNEL);
if (!li) if (!li)
return -ENOMEM; return -ENOMEM;
...@@ -818,7 +818,6 @@ static int simple_probe(struct platform_device *pdev) ...@@ -818,7 +818,6 @@ static int simple_probe(struct platform_device *pdev)
if (ret < 0) if (ret < 0)
goto err; goto err;
devm_kfree(dev, li);
return 0; return 0;
err: err:
simple_util_clean_reference(card); simple_util_clean_reference(card);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment