diff mbox series

drm/pl111: Fix missing unwind goto in pl111_amba_probe()

Message ID 20230329171824.1159104-1-harshit.m.mogalapalli@oracle.com (mailing list archive)
State New, archived
Headers show
Series drm/pl111: Fix missing unwind goto in pl111_amba_probe() | expand

Commit Message

Harshit Mogalapalli March 29, 2023, 5:18 p.m. UTC
Smatch reports:
	drivers/gpu/drm/pl111/pl111_drv.c:300
	pl111_amba_probe() warn: missing unwind goto?

When devm_request_irq() returns non-zero value, we need to drop the
reference for drm device and also release reserved memory which is
done in "dev_put" label. So instead of directly returning, goto dev_put
to fix this bug.

Fixes: bed41005e617 ("drm/pl111: Initial drm/kms driver for pl111")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is based on static analysis, Only Compile tested.
---
 drivers/gpu/drm/pl111/pl111_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Javier Martinez Canillas July 19, 2023, 9:04 p.m. UTC | #1
Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> writes:

> Smatch reports:
> 	drivers/gpu/drm/pl111/pl111_drv.c:300
> 	pl111_amba_probe() warn: missing unwind goto?
>
> When devm_request_irq() returns non-zero value, we need to drop the
> reference for drm device and also release reserved memory which is
> done in "dev_put" label. So instead of directly returning, goto dev_put
> to fix this bug.
>
> Fixes: bed41005e617 ("drm/pl111: Initial drm/kms driver for pl111")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
> This is based on static analysis, Only Compile tested.
> ---
>  drivers/gpu/drm/pl111/pl111_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

The patch looks correct to me.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c
index 4b2a9e9753f6..72c5d3681b47 100644
--- a/drivers/gpu/drm/pl111/pl111_drv.c
+++ b/drivers/gpu/drm/pl111/pl111_drv.c
@@ -297,7 +297,7 @@  static int pl111_amba_probe(struct amba_device *amba_dev,
 			       variant->name, priv);
 	if (ret != 0) {
 		dev_err(dev, "%s failed irq %d\n", __func__, ret);
-		return ret;
+		goto dev_put;
 	}
 
 	ret = pl111_modeset_init(drm);