[PATCH v4 14/21] dma: Eliminate unused variable in dma_get_cfg()

Michal Suchanek msuchanek at suse.de
Sun Sep 25 10:28:07 CEST 2022


The ret value is never used. It is only set when no device is returned,
and that is handled before the value of ret would be used.

Signed-off-by: Michal Suchanek <msuchanek at suse.de>
---
 drivers/dma/dma-uclass.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c
index 012609bb53..952cbc2170 100644
--- a/drivers/dma/dma-uclass.c
+++ b/drivers/dma/dma-uclass.c
@@ -209,10 +209,9 @@ int dma_get_cfg(struct dma *dma, u32 cfg_id, void **cfg_data)
 int dma_get_device(u32 transfer_type, struct udevice **devp)
 {
 	struct udevice *dev;
-	int ret;
 
-	for (ret = uclass_first_device(UCLASS_DMA, &dev); dev && !ret;
-	     ret = uclass_next_device(&dev)) {
+	for (uclass_first_device(UCLASS_DMA, &dev); dev;
+	     uclass_next_device(&dev)) {
 		struct dma_dev_priv *uc_priv;
 
 		uc_priv = dev_get_uclass_priv(dev);
@@ -228,7 +227,7 @@ int dma_get_device(u32 transfer_type, struct udevice **devp)
 
 	*devp = dev;
 
-	return ret;
+	return 0;
 }
 
 int dma_memcpy(void *dst, void *src, size_t len)
-- 
2.37.3



More information about the U-Boot mailing list