Message ID | 20200219102122.1607365-8-daniel.vetter@ffwll.ch (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm_device managed resources | expand |
Hi Daniel, Thank you for the patch. On Wed, Feb 19, 2020 at 11:20:37AM +0100, Daniel Vetter wrote: > With this we can drop the final kfree from the release function. > > v2: We need drm_dev_put to unroll the driver creation (once > drm_dev_init and drmm_add_final_kfree suceeded), otherwise > the drmm_ magic doesn't happen. > > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Did you mean to squash this with the previous commit ? > Cc: Dave Airlie <airlied@redhat.com> > Cc: Sean Paul <sean@poorly.run> > Cc: Thomas Zimmermann <tzimmermann@suse.de> > Cc: Emil Velikov <emil.l.velikov@gmail.com> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > Cc: "Noralf Trønnes" <noralf@tronnes.org> > Cc: Thomas Gleixner <tglx@linutronix.de> > Cc: Sam Ravnborg <sam@ravnborg.org> > --- > drivers/gpu/drm/udl/udl_drv.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c > index d5b89711ab1e..6a5594946096 100644 > --- a/drivers/gpu/drm/udl/udl_drv.c > +++ b/drivers/gpu/drm/udl/udl_drv.c > @@ -81,8 +81,7 @@ static struct udl_device *udl_driver_create(struct usb_interface *interface) > > r = udl_init(udl); > if (r) { > - drm_dev_fini(&udl->drm); > - kfree(udl); > + drm_dev_put(&udl->drm); > return ERR_PTR(r); > } >
On Wed, Feb 19, 2020 at 2:42 PM Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote: > > Hi Daniel, > > Thank you for the patch. > > On Wed, Feb 19, 2020 at 11:20:37AM +0100, Daniel Vetter wrote: > > With this we can drop the final kfree from the release function. > > > > v2: We need drm_dev_put to unroll the driver creation (once > > drm_dev_init and drmm_add_final_kfree suceeded), otherwise > > the drmm_ magic doesn't happen. > > > > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> > > Did you mean to squash this with the previous commit ? Uh yes indeed. Will squash. -Daniel > > > Cc: Dave Airlie <airlied@redhat.com> > > Cc: Sean Paul <sean@poorly.run> > > Cc: Thomas Zimmermann <tzimmermann@suse.de> > > Cc: Emil Velikov <emil.l.velikov@gmail.com> > > Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > > Cc: "Noralf Trønnes" <noralf@tronnes.org> > > Cc: Thomas Gleixner <tglx@linutronix.de> > > Cc: Sam Ravnborg <sam@ravnborg.org> > > --- > > drivers/gpu/drm/udl/udl_drv.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c > > index d5b89711ab1e..6a5594946096 100644 > > --- a/drivers/gpu/drm/udl/udl_drv.c > > +++ b/drivers/gpu/drm/udl/udl_drv.c > > @@ -81,8 +81,7 @@ static struct udl_device *udl_driver_create(struct usb_interface *interface) > > > > r = udl_init(udl); > > if (r) { > > - drm_dev_fini(&udl->drm); > > - kfree(udl); > > + drm_dev_put(&udl->drm); > > return ERR_PTR(r); > > } > > > > -- > Regards, > > Laurent Pinchart
diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c index d5b89711ab1e..6a5594946096 100644 --- a/drivers/gpu/drm/udl/udl_drv.c +++ b/drivers/gpu/drm/udl/udl_drv.c @@ -81,8 +81,7 @@ static struct udl_device *udl_driver_create(struct usb_interface *interface) r = udl_init(udl); if (r) { - drm_dev_fini(&udl->drm); - kfree(udl); + drm_dev_put(&udl->drm); return ERR_PTR(r); }
With this we can drop the final kfree from the release function. v2: We need drm_dev_put to unroll the driver creation (once drm_dev_init and drmm_add_final_kfree suceeded), otherwise the drmm_ magic doesn't happen. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Sean Paul <sean@poorly.run> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Emil Velikov <emil.l.velikov@gmail.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: "Noralf Trønnes" <noralf@tronnes.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Sam Ravnborg <sam@ravnborg.org> --- drivers/gpu/drm/udl/udl_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)