Skip to contentSkip to conversation

i2c: qup: release the DMA channels if getting the interconnect path fails

PATCH New Cong Nguyen 1 participant 1 message Nov 25

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: qup: release the DMA channels if getting the interconnect path fails

On QUP v2 controllers, qup_i2c_probe() requests the tx and rx DMA channels with qup_i2c_req_dma(), then gets the interconnect path. If devm_of_icc_get() fails, for example with -EPROBE_DEFER, probe returns directly. The channels are not devm managed, so they are never released and stay held after probe has failed.

Every other failure after the channels are requested goes to fail_dma, which releases them. Do the same here.

Fixes d4f35233a634 ("i2c: qup: Vote for interconnect bandwidth to DRAM")
---
 drivers/i2c/busses/i2c-qup.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-qup.c +5 -3
index 731bce9f9a92..53e74de5244b 100644
@@ -1784,9 +1784,11 @@ static int qup_i2c_probe(struct platform_device *pdev)
 		qup->is_dma = true;
 
 		qup->icc_path = devm_of_icc_get(&pdev->dev, NULL);
-		if (IS_ERR(qup->icc_path))
-			return dev_err_probe(&pdev->dev, PTR_ERR(qup->icc_path),
-					     "failed to get interconnect path\n");
+		if (IS_ERR(qup->icc_path)) {
+			ret = dev_err_probe(&pdev->dev, PTR_ERR(qup->icc_path),
+					    "failed to get interconnect path\n");
+			goto fail_dma;
+		}
 	}
 
 nodma:
Signature · 1 line
2.25.1