Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dma: dma-axi-dmac: simplify axi_dmac_parse_dt()

Simplify axi_dmac_parse_dt() by using the cleanup device_node class for
automatically releasing the of_node reference when going out of scope.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
base-commit: 398035178503bf662281bbffb4bebce1460a4bc5
change-id: 20251104-axi-dmac-fixes-and-improvs-e3ad512a329c
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Link: https://patch.msgid.link/20251104-axi-dmac-fixes-and-improvs-v1-4-3e6fd9328f72@analog.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Nuno Sá and committed by
Vinod Koul
c23918be b2440442

+5 -8
+5 -8
drivers/dma/dma-axi-dmac.c
··· 8 8 9 9 #include <linux/adi-axi-common.h> 10 10 #include <linux/bitfield.h> 11 + #include <linux/cleanup.h> 11 12 #include <linux/clk.h> 12 13 #include <linux/device.h> 13 14 #include <linux/dma-mapping.h> ··· 928 927 929 928 static int axi_dmac_parse_dt(struct device *dev, struct axi_dmac *dmac) 930 929 { 931 - struct device_node *of_channels, *of_chan; 932 930 int ret; 933 931 934 - of_channels = of_get_child_by_name(dev->of_node, "adi,channels"); 932 + struct device_node *of_channels __free(device_node) = of_get_child_by_name(dev->of_node, 933 + "adi,channels"); 935 934 if (of_channels == NULL) 936 935 return -ENODEV; 937 936 938 - for_each_child_of_node(of_channels, of_chan) { 937 + for_each_child_of_node_scoped(of_channels, of_chan) { 939 938 ret = axi_dmac_parse_chan_dt(of_chan, &dmac->chan); 940 - if (ret) { 941 - of_node_put(of_chan); 942 - of_node_put(of_channels); 939 + if (ret) 943 940 return -EINVAL; 944 - } 945 941 } 946 - of_node_put(of_channels); 947 942 948 943 return 0; 949 944 }