Skip to contentSkip to conversation

gpu: ipu-pre: handle clock enable failures

PATCH New Jiawen Liu 1 participant 1 message Aug 18

Subsystems (2)
lore
Share & tools
lore

Jiawen Liu

author
#0 lore raw

PATCH 1/1 gpu: ipu-pre: handle clock enable failures

Check clock-enable failures after a manually managed allocation.

Release the earlier allocation and return the original clock error when probe cannot enable the clock.

---

drivers/gpu/ipu-v3/ipu-pre.c +7 -1
@@ -311,6 +311,7 @@
 {
 	struct device *dev = &pdev->dev;
 	struct ipu_pre *pre;
+	int ret;
 
 	pre = devm_kzalloc(dev, sizeof(*pre), GFP_KERNEL);
 	if (!pre)
@@ -339,7 +340,12 @@
 	if (!pre->buffer_virt)
 		return -ENOMEM;
 
-	clk_prepare_enable(pre->clk_axi);
+	ret = clk_prepare_enable(pre->clk_axi);
+	if (ret) {
+		gen_pool_free(pre->iram, (unsigned long)pre->buffer_virt,
+			      IPU_PRE_MAX_WIDTH * IPU_PRE_NUM_SCANLINES * 4);
+		return ret;
+	}
 
 	pre->dev = dev;
 	platform_set_drvdata(pdev, pre);