gpu: ipu-pre: handle clock enable failures
Subsystems (2)
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.
Signed-off-by jiawen <[email protected]>
---
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);