diff options
author | Siddharth Vadapalli <s-vadapalli@ti.com> | 2024-02-20 15:34:51 +0530 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-03-04 13:41:04 -0500 |
commit | 333031011c8fcd3020caef41128f9687725c462c (patch) | |
tree | 49288e763b6298481133de32957f45a672f8bb54 | |
parent | f05add3822a09273392bc9c74b6dc4d6a42917ec (diff) | |
download | u-boot-333031011c8fcd3020caef41128f9687725c462c.zip u-boot-333031011c8fcd3020caef41128f9687725c462c.tar.gz u-boot-333031011c8fcd3020caef41128f9687725c462c.tar.bz2 |
dma: ti: k3-udma: Fix error handling for setup_resources() in udma_probe()
In udma_probe() the return value of setup_resources() is stored in the
u32 "ch_count" member of "struct udma_dev", due to which any negative
return value which indicates an error is masked.
Fix this by storing the return value of setup_resources() in the already
declared integer variable "ret", followed by assigning it to the "ch_count"
member of "struct udma_dev" in case of no error.
While at it, change the "return ret" at the end of udma_probe() to a
"return 0", to explicitly indicate that probe was successful.
Fixes: a8837cf43839 ("dma: ti: k3-udma: Query DMA channels allocated from Resource Manager")
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
-rw-r--r-- | drivers/dma/ti/k3-udma.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c index eea9ec9..ed0a9bf 100644 --- a/drivers/dma/ti/k3-udma.c +++ b/drivers/dma/ti/k3-udma.c @@ -1770,9 +1770,11 @@ static int udma_probe(struct udevice *dev) return PTR_ERR(ud->ringacc); ud->dev = dev; - ud->ch_count = setup_resources(ud); - if (ud->ch_count <= 0) - return ud->ch_count; + ret = setup_resources(ud); + if (ret < 0) + return ret; + + ud->ch_count = ret; for (i = 0; i < ud->bchan_cnt; i++) { struct udma_bchan *bchan = &ud->bchans[i]; @@ -1831,7 +1833,7 @@ static int udma_probe(struct udevice *dev) uc_priv->supported = DMA_SUPPORTS_MEM_TO_MEM | DMA_SUPPORTS_MEM_TO_DEV; - return ret; + return 0; } static int udma_push_to_ring(struct k3_nav_ring *ring, void *elem) |