Skip to content

Commit 7d996c8

Browse files
krzkbroonie
authored andcommitted
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: Krzysztof Kozlowski <[email protected]> Acked-by: Kuninori Morimoto <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b39f771 commit 7d996c8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

sound/soc/generic/simple-card.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Copyright (C) 2012 Renesas Solutions Corp.
66
// Kuninori Morimoto <[email protected]>
77

8+
#include <linux/cleanup.h>
89
#include <linux/clk.h>
910
#include <linux/device.h>
1011
#include <linux/module.h>
@@ -727,7 +728,6 @@ static int simple_probe(struct platform_device *pdev)
727728
struct device *dev = &pdev->dev;
728729
struct device_node *np = dev->of_node;
729730
struct snd_soc_card *card;
730-
struct link_info *li;
731731
int ret;
732732

733733
/* Allocate the private data and the DAI link array */
@@ -741,7 +741,7 @@ static int simple_probe(struct platform_device *pdev)
741741
card->probe = simple_soc_probe;
742742
card->driver_name = "simple-card";
743743

744-
li = devm_kzalloc(dev, sizeof(*li), GFP_KERNEL);
744+
struct link_info *li __free(kfree) = kzalloc(sizeof(*li), GFP_KERNEL);
745745
if (!li)
746746
return -ENOMEM;
747747

@@ -818,7 +818,6 @@ static int simple_probe(struct platform_device *pdev)
818818
if (ret < 0)
819819
goto err;
820820

821-
devm_kfree(dev, li);
822821
return 0;
823822
err:
824823
simple_util_clean_reference(card);

0 commit comments

Comments
 (0)