diff mbox series

drm: fix ifnullfree.cocci warnings

Message ID alpine.DEB.2.21.2003270908410.2709@hadrien (mailing list archive)
State New, archived
Headers show
Series drm: fix ifnullfree.cocci warnings | expand

Commit Message

Julia Lawall March 27, 2020, 8:11 a.m. UTC
NULL check before kfree is not needed.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes: c6603c740e0e ("drm: add managed resources tied to drm_device")
Signed-off-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---

tree:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
head:   9e1ed9fb1eb0a4bc43a26365c592d3095286038b
commit: c6603c740e0e3492c9c95fdab833375bf7117b6b [1587/1636] drm: add managed resources tied to drm_device
:::::: branch date: 8 hours ago
:::::: commit date: 9 hours ago

Up to you, if you tihnk it is useful...

 drm_drv.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Daniel Vetter March 31, 2020, 7:47 a.m. UTC | #1
On Fri, Mar 27, 2020 at 09:11:44AM +0100, Julia Lawall wrote:
> NULL check before kfree is not needed.
> 
> Generated by: scripts/coccinelle/free/ifnullfree.cocci
> 
> Fixes: c6603c740e0e ("drm: add managed resources tied to drm_device")
> Signed-off-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
> ---
> 
> tree:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next

Hm this doesn't apply anymore, the patch is for an interim state (because
bisectability). Care to regen (the pattern still exists), I'm happy to
apply.
-Daniel

> head:   9e1ed9fb1eb0a4bc43a26365c592d3095286038b
> commit: c6603c740e0e3492c9c95fdab833375bf7117b6b [1587/1636] drm: add managed resources tied to drm_device
> :::::: branch date: 8 hours ago
> :::::: commit date: 9 hours ago
> 
> Up to you, if you tihnk it is useful...
> 
>  drm_drv.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -837,8 +837,9 @@ static void drm_dev_release(struct kref
>  	if (!dev->driver->release && !dev->managed.final_kfree) {
>  		WARN_ON(!list_empty(&dev->managed.resources));
>  		kfree(dev);
> -	} else if (dev->managed.final_kfree)
> +	} else {
>  		kfree(dev->managed.final_kfree);
> +	}
>  }
> 
>  /**
Julia Lawall March 31, 2020, 11:43 a.m. UTC | #2
On Tue, 31 Mar 2020, Daniel Vetter wrote:

> On Fri, Mar 27, 2020 at 09:11:44AM +0100, Julia Lawall wrote:
> > NULL check before kfree is not needed.
> >
> > Generated by: scripts/coccinelle/free/ifnullfree.cocci
> >
> > Fixes: c6603c740e0e ("drm: add managed resources tied to drm_device")
> > Signed-off-by: kbuild test robot <lkp@intel.com>
> > Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
> > ---
> >
> > tree:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
>
> Hm this doesn't apply anymore, the patch is for an interim state (because
> bisectability). Care to regen (the pattern still exists), I'm happy to
> apply.

Maybe 0-day will produce it again?

julia

> -Daniel
>
> > head:   9e1ed9fb1eb0a4bc43a26365c592d3095286038b
> > commit: c6603c740e0e3492c9c95fdab833375bf7117b6b [1587/1636] drm: add managed resources tied to drm_device
> > :::::: branch date: 8 hours ago
> > :::::: commit date: 9 hours ago
> >
> > Up to you, if you tihnk it is useful...
> >
> >  drm_drv.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > --- a/drivers/gpu/drm/drm_drv.c
> > +++ b/drivers/gpu/drm/drm_drv.c
> > @@ -837,8 +837,9 @@ static void drm_dev_release(struct kref
> >  	if (!dev->driver->release && !dev->managed.final_kfree) {
> >  		WARN_ON(!list_empty(&dev->managed.resources));
> >  		kfree(dev);
> > -	} else if (dev->managed.final_kfree)
> > +	} else {
> >  		kfree(dev->managed.final_kfree);
> > +	}
> >  }
> >
> >  /**
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
>
diff mbox series

Patch

--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -837,8 +837,9 @@  static void drm_dev_release(struct kref
 	if (!dev->driver->release && !dev->managed.final_kfree) {
 		WARN_ON(!list_empty(&dev->managed.resources));
 		kfree(dev);
-	} else if (dev->managed.final_kfree)
+	} else {
 		kfree(dev->managed.final_kfree);
+	}
 }

 /**