drm/lima/lima_drv: Add missing unwind goto in lima_pdev_probe()

Message ID 20230314052711.4061652-1-harshit.m.mogalapalli@oracle.com
State New
Headers
Series drm/lima/lima_drv: Add missing unwind goto in lima_pdev_probe() |

Commit Message

Harshit Mogalapalli March 14, 2023, 5:27 a.m. UTC
  Smatch reports:
drivers/gpu/drm/lima/lima_drv.c:396 lima_pdev_probe() warn:
	missing unwind goto?

Store return value in err and goto 'err_out0' which has
lima_sched_slab_fini() before returning.

Fixes: a1d2a6339961 ("drm/lima: driver for ARM Mali4xx GPUs")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
Only compile tested.
---
 drivers/gpu/drm/lima/lima_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Qiang Yu March 14, 2023, 6:22 a.m. UTC | #1
Reviewed-by: Qiang Yu <yuq825@gmail.com>

On Tue, Mar 14, 2023 at 1:27 PM Harshit Mogalapalli
<harshit.m.mogalapalli@oracle.com> wrote:
>
> Smatch reports:
> drivers/gpu/drm/lima/lima_drv.c:396 lima_pdev_probe() warn:
>         missing unwind goto?
>
> Store return value in err and goto 'err_out0' which has
> lima_sched_slab_fini() before returning.
>
> Fixes: a1d2a6339961 ("drm/lima: driver for ARM Mali4xx GPUs")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
> Only compile tested.
> ---
>  drivers/gpu/drm/lima/lima_drv.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/lima/lima_drv.c b/drivers/gpu/drm/lima/lima_drv.c
> index 7b8d7178d09a..39cab4a55f57 100644
> --- a/drivers/gpu/drm/lima/lima_drv.c
> +++ b/drivers/gpu/drm/lima/lima_drv.c
> @@ -392,8 +392,10 @@ static int lima_pdev_probe(struct platform_device *pdev)
>
>         /* Allocate and initialize the DRM device. */
>         ddev = drm_dev_alloc(&lima_drm_driver, &pdev->dev);
> -       if (IS_ERR(ddev))
> -               return PTR_ERR(ddev);
> +       if (IS_ERR(ddev)) {
> +               err = PTR_ERR(ddev);
> +               goto err_out0;
> +       }
>
>         ddev->dev_private = ldev;
>         ldev->ddev = ddev;
> --
> 2.38.1
>
  
Qiang Yu April 2, 2023, 10:22 a.m. UTC | #2
Applied to drm-misc-next.

On Tue, Mar 14, 2023 at 2:22 PM Qiang Yu <yuq825@gmail.com> wrote:
>
> Reviewed-by: Qiang Yu <yuq825@gmail.com>
>
> On Tue, Mar 14, 2023 at 1:27 PM Harshit Mogalapalli
> <harshit.m.mogalapalli@oracle.com> wrote:
> >
> > Smatch reports:
> > drivers/gpu/drm/lima/lima_drv.c:396 lima_pdev_probe() warn:
> >         missing unwind goto?
> >
> > Store return value in err and goto 'err_out0' which has
> > lima_sched_slab_fini() before returning.
> >
> > Fixes: a1d2a6339961 ("drm/lima: driver for ARM Mali4xx GPUs")
> > Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> > ---
> > Only compile tested.
> > ---
> >  drivers/gpu/drm/lima/lima_drv.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/lima/lima_drv.c b/drivers/gpu/drm/lima/lima_drv.c
> > index 7b8d7178d09a..39cab4a55f57 100644
> > --- a/drivers/gpu/drm/lima/lima_drv.c
> > +++ b/drivers/gpu/drm/lima/lima_drv.c
> > @@ -392,8 +392,10 @@ static int lima_pdev_probe(struct platform_device *pdev)
> >
> >         /* Allocate and initialize the DRM device. */
> >         ddev = drm_dev_alloc(&lima_drm_driver, &pdev->dev);
> > -       if (IS_ERR(ddev))
> > -               return PTR_ERR(ddev);
> > +       if (IS_ERR(ddev)) {
> > +               err = PTR_ERR(ddev);
> > +               goto err_out0;
> > +       }
> >
> >         ddev->dev_private = ldev;
> >         ldev->ddev = ddev;
> > --
> > 2.38.1
> >
  

Patch

diff --git a/drivers/gpu/drm/lima/lima_drv.c b/drivers/gpu/drm/lima/lima_drv.c
index 7b8d7178d09a..39cab4a55f57 100644
--- a/drivers/gpu/drm/lima/lima_drv.c
+++ b/drivers/gpu/drm/lima/lima_drv.c
@@ -392,8 +392,10 @@  static int lima_pdev_probe(struct platform_device *pdev)
 
 	/* Allocate and initialize the DRM device. */
 	ddev = drm_dev_alloc(&lima_drm_driver, &pdev->dev);
-	if (IS_ERR(ddev))
-		return PTR_ERR(ddev);
+	if (IS_ERR(ddev)) {
+		err = PTR_ERR(ddev);
+		goto err_out0;
+	}
 
 	ddev->dev_private = ldev;
 	ldev->ddev = ddev;