dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Hyun Kwon <hyun.kwon@xilinx.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	Michal Simek <michals@xilinx.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Daniel Vetter <daniel.vetter@intel.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] drm/xlnx: Use devm_drm_dev_alloc
Date: Fri, 11 Sep 2020 10:47:12 +0200	[thread overview]
Message-ID: <20200911084712.GN438822@phenom.ffwll.local> (raw)
In-Reply-To: <20200908191600.GA1569998@xilinx.com>

On Tue, Sep 08, 2020 at 12:16:00PM -0700, Hyun Kwon wrote:
> Hi Daniel,
> 
> On Mon, Sep 07, 2020 at 01:22:25AM -0700, Daniel Vetter wrote:
> > Gets rid of drmm_add_final_kfree, which I want to unexport so that it
> > stops confusion people about this transitional state of rolling drm
> > managed memory out.
> > 
> > This also fixes the missing drm_dev_put in the error path of the probe
> > code.
> > 
> > v2: Drop the misplaced drm_dev_put from zynqmp_dpsub_drm_init (all
> > other paths leaked on error, this should have been in
> > zynqmp_dpsub_probe), now that subsumed by the auto-cleanup of
> > devm_drm_dev_alloc.
> > 
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Hyun Kwon <hyun.kwon@xilinx.com>
> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Michal Simek <michal.simek@xilinx.com>
> > Cc: linux-arm-kernel@lists.infradead.org
> 
> Looks correct to me.
> 
> Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>

Merged all patches up to this one here to drm-misc-next.
-Daniel

> 
> Thanks!
> 
> -hyun
> 
> > ---
> >  drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 27 ++++++---------------------
> >  1 file changed, 6 insertions(+), 21 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> > index 26328c76305b..8e69303aad3f 100644
> > --- a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> > +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> > @@ -111,7 +111,7 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
> >  	/* Initialize mode config, vblank and the KMS poll helper. */
> >  	ret = drmm_mode_config_init(drm);
> >  	if (ret < 0)
> > -		goto err_dev_put;
> > +		return ret;
> >  
> >  	drm->mode_config.funcs = &zynqmp_dpsub_mode_config_funcs;
> >  	drm->mode_config.min_width = 0;
> > @@ -121,7 +121,7 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
> >  
> >  	ret = drm_vblank_init(drm, 1);
> >  	if (ret)
> > -		goto err_dev_put;
> > +		return ret;
> >  
> >  	drm->irq_enabled = 1;
> >  
> > @@ -154,8 +154,6 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
> >  
> >  err_poll_fini:
> >  	drm_kms_helper_poll_fini(drm);
> > -err_dev_put:
> > -	drm_dev_put(drm);
> >  	return ret;
> >  }
> >  
> > @@ -208,27 +206,16 @@ static int zynqmp_dpsub_probe(struct platform_device *pdev)
> >  	int ret;
> >  
> >  	/* Allocate private data. */
> > -	dpsub = kzalloc(sizeof(*dpsub), GFP_KERNEL);
> > -	if (!dpsub)
> > -		return -ENOMEM;
> > +	dpsub = devm_drm_dev_alloc(&pdev->dev, &zynqmp_dpsub_drm_driver,
> > +				   struct zynqmp_dpsub, drm);
> > +	if (IS_ERR(dpsub))
> > +		return PTR_ERR(dpsub);
> >  
> >  	dpsub->dev = &pdev->dev;
> >  	platform_set_drvdata(pdev, dpsub);
> >  
> >  	dma_set_mask(dpsub->dev, DMA_BIT_MASK(ZYNQMP_DISP_MAX_DMA_BIT));
> >  
> > -	/*
> > -	 * Initialize the DRM device early, as the DRM core mandates usage of
> > -	 * the managed memory helpers tied to the DRM device.
> > -	 */
> > -	ret = drm_dev_init(&dpsub->drm, &zynqmp_dpsub_drm_driver, &pdev->dev);
> > -	if (ret < 0) {
> > -		kfree(dpsub);
> > -		return ret;
> > -	}
> > -
> > -	drmm_add_final_kfree(&dpsub->drm, dpsub);
> > -
> >  	/* Try the reserved memory. Proceed if there's none. */
> >  	of_reserved_mem_device_init(&pdev->dev);
> >  
> > @@ -286,8 +273,6 @@ static int zynqmp_dpsub_remove(struct platform_device *pdev)
> >  	clk_disable_unprepare(dpsub->apb_clk);
> >  	of_reserved_mem_device_release(&pdev->dev);
> >  
> > -	drm_dev_put(drm);
> > -
> >  	return 0;
> >  }
> >  
> > -- 
> > 2.28.0
> > 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-09-11  8:47 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04 14:39 [PATCH 00/24] drm_managed, leftovers Daniel Vetter
2020-09-04 14:39 ` [PATCH 01/24] drm/armada: Use devm_drm_dev_alloc Daniel Vetter
2020-09-10  1:20   ` Dave Airlie
2020-09-04 14:39 ` [PATCH 02/24] drm/armada: Don't use drm_device->dev_private Daniel Vetter
2020-09-04 14:39 ` [PATCH 03/24] drm/aspeed: Use managed drmm_mode_config_cleanup Daniel Vetter
2020-09-04 14:39 ` [PATCH 04/24] drm/vgem: Use devm_drm_dev_alloc Daniel Vetter
2020-09-09 11:01   ` Melissa Wen
2020-09-09 11:20     ` Daniel Vetter
2020-09-09 16:29       ` Melissa Wen
2020-09-09 12:07   ` [PATCH] " Daniel Vetter
2020-09-04 14:39 ` [PATCH 05/24] drm/vkms: " Daniel Vetter
2020-09-08 23:42   ` Melissa Wen
2020-09-09  9:18   ` [PATCH] " Daniel Vetter
2020-09-09  9:22     ` Melissa Wen
2020-09-04 14:39 ` [PATCH 06/24] drm/xlnx: " Daniel Vetter
2020-09-07  8:22   ` [PATCH] " Daniel Vetter
2020-09-08 19:16     ` Hyun Kwon
2020-09-11  8:47       ` Daniel Vetter [this message]
2020-09-04 14:39 ` [PATCH 07/24] drm/i915/selftest: Create mock_destroy_device Daniel Vetter
2020-09-04 14:39 ` [PATCH 08/24] drm/i915/selftests: align more to real device lifetimes Daniel Vetter
2020-09-11  8:59   ` [Intel-gfx] " Maarten Lankhorst
2020-09-11  9:08   ` Matthew Auld
2020-09-04 14:39 ` [PATCH 09/24] drm/dev: Remove drm_dev_init Daniel Vetter
2020-09-04 14:39 ` [PATCH 10/24] drm/arc: Switch to devm_drm_dev_alloc Daniel Vetter
2020-10-23 12:31   ` Daniel Vetter
2020-09-04 14:39 ` [PATCH 11/24] drm/arc: Stop using drm_device->dev_private Daniel Vetter
2020-09-04 15:09   ` Daniel Vetter
2020-09-04 14:39 ` [PATCH 12/24] drm/arc: Delete arcpgu_priv->fb Daniel Vetter
2020-09-04 14:39 ` [PATCH 13/24] drm/arc: Embedded a drm_simple_display_pipe Daniel Vetter
2020-09-04 14:39 ` [PATCH 14/24] drm/arc: Embedd a drm_connector for sim case Daniel Vetter
2020-09-04 14:39 ` [PATCH 15/24] drm/arc: Drop surplus connector registration Daniel Vetter
2020-09-04 14:39 ` [PATCH 16/24] drm/arc: Use drmm_mode_config_cleanup Daniel Vetter
2020-09-04 14:39 ` [PATCH 17/24] drm/arc: Align with simple pipe helpers Daniel Vetter
2020-09-04 14:39 ` [PATCH 18/24] drm/arc: Convert to drm_simple_kms_pipe_helper Daniel Vetter
2020-09-04 14:39 ` [PATCH 19/24] drm/arc: Drop crtc check in arc_pgu_update Daniel Vetter
2020-09-04 14:39 ` [PATCH 20/24] drm/arc: Inline arcpgu_crtc.c Daniel Vetter
2020-09-04 14:39 ` [PATCH 21/24] drm/arc: Inline arcpgu_drm_hdmi_init Daniel Vetter
2020-09-04 14:39 ` [PATCH 22/24] drm/arc: Inline remaining files Daniel Vetter
2020-09-04 14:39 ` [PATCH 23/24] drm/arc: Initialize sim connector before display pipe Daniel Vetter
2020-09-04 14:39 ` [PATCH 24/24] drm/arc: Move to drm/tiny Daniel Vetter
2020-09-09  7:54   ` Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200911084712.GN438822@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hyun.kwon@xilinx.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=michals@xilinx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).