drm/etnaviv: check for errors when enabling clocks
Subsystems (2)
PATCH 1/3 drm/etnaviv: check for errors when enabling clocks
clk_prepare_enable() may fail, so we should better check for its return value and propagate it in the case of failure.
--- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +24 -6
@@ -872,12 +872,25 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m)*/ static int enable_clk (struct etnaviv_gpu *gpu) { -if (gpu->clk_core) -clk_prepare_enable (gpu->clk_core); -if (gpu->clk_shader) -clk_prepare_enable (gpu->clk_shader); +int ret; + +if (gpu->clk_core) { + ret =clk_prepare_enable (gpu->clk_core); +if (ret) +return ret; + } + +if (gpu->clk_shader) { + ret =clk_prepare_enable (gpu->clk_shader); +if (ret) + goto disable_clk_core; + }return 0 ; + +disable_clk_core: +clk_disable_unprepare (gpu->clk_core); +return ret; }static int disable_clk (struct etnaviv_gpu *gpu)
@@ -892,8 +905,13 @@ static int disable_clk(struct etnaviv_gpu *gpu)static int enable_axi (struct etnaviv_gpu *gpu) { -if (gpu->clk_bus) -clk_prepare_enable (gpu->clk_bus); +int ret; + +if (gpu->clk_bus) { + ret =clk_prepare_enable (gpu->clk_bus); +if (ret) +return ret; + }return 0 ; }
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/3 drm/etnaviv: remove unneeded 'fail' label
In the etnaviv_gpu_platform_probe() error path the 'fail' label is used to just return the error code.
This can be simplified by returning the error code immediately, so get rid of the unneeded 'fail' label.
--- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +4 -8
@@ -1669,16 +1669,15 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)/* Get Interrupt: */ gpu->irq =platform_get_irq (pdev,0 );if (gpu->irq <0 ) { - err = gpu->irq; -dev_err (dev,"failed to get irq: %d\n" , err); - goto fail; +dev_err (dev,"failed to get irq: %d\n" , gpu->irq); +return gpu->irq; } err =devm_request_irq (&pdev->dev, gpu->irq, irq_handler,0 ,dev_name (gpu->dev), gpu);if (err) {dev_err (dev,"failed to request IRQ%u: %d\n" , gpu->irq, err); - goto fail; +return err; }/* Get Clocks: */
@@ -1712,13 +1711,10 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev) err =component_add (&pdev->dev, &gpu_ops);if (err <0 ) {dev_err (&pdev->dev,"failed to register component: %d\n" , err); - goto fail; +return err; }return 0 ; - -fail: -return err; }static int etnaviv_gpu_platform_remove (struct platform_device *pdev)
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 drm/etnaviv: remove unneeded variable initialization
In reply to Fabio EstevamThere is no need to initialize variable 'err' with 0 because it will be properly assigned later on.
--- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +1 -1
@@ -1652,7 +1652,7 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct etnaviv_gpu *gpu; -int err =0 ; +int err; gpu =devm_kzalloc (dev,sizeof (*gpu),GFP_KERNEL );if (!gpu)
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Lucas Stach
maintainerRe: [PATCH 3/3] drm/etnaviv: remove unneeded variable initialization
Am Sonntag, den 21.08.2016, 19:32 -0300 schrieb Fabio Estevam:
Quoted 13 lines
There is no need to initialize variable 'err' with 0 because it will be properly assigned later on.
Signed-off-by Fabio Estevam <[email protected]>--- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/etnaviv/etnaviv_gpu.c +0
-0
drivers/gpu/drm/etnaviv/etnaviv_gpu.c static int etnaviv_gpu_platform_probe(struct platform_device *pdev) · line 1655
Quoted 5 lines
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +1
-1@@ -1652,7 +1652,7 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct etnaviv_gpu *gpu; -int err =0 ; +int err;
This looks like churn to me, and I wouldn't take this patch if it would stand on its own. But as it's part of the series and the other 2 patches look good to me, I'll take the whole series.
Thanks,
Lucas
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel