Patch "drm: rcar-du: Simplify and fix probe error handling" has been added to the 4.9-stable tree
Subsystems (4)
This is a note to let you know that I've just added the patch titled
drm: rcar-du: Simplify and fix probe error handling
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
drm-rcar-du-simplify-and-fix-probe-error-handling.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
4f7b0d263833928e947e172eff2d2997179c5cb9Mon Sep 17 00:00:00 2001
From: Laurent Pinchart <[email protected]>
Date: Wed, 19 Oct 2016 00:51:35 +0300
Subject: drm: rcar-du: Simplify and fix probe error handling
From: Laurent Pinchart <[email protected]>
commit 4f7b0d263833928e947e172eff2d2997179c5cb9 upstream.
It isn't safe to call drm_dev_unregister() without first initializing mode setting with drm_mode_config_init(). This leads to a crash if either IO memory can't be remapped or vblank initialization fails.
Fix this by reordering the initialization sequence. Move vblank initialization after the drm_mode_config_init() call, and move IO remapping before drm_dev_alloc() to avoid the need to perform clean up in case of failure.
While at it remove the explicit drm_vblank_cleanup() call from rcar_du_remove() as the drm_dev_unregister() function already cleans up vblank.
--- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 30 ++++++++++-------------------- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 7 +++++++ 2 files changed, 17 insertions(+), 20 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_drv.c +10 -20
@@ -285,7 +285,6 @@ static int rcar_du_remove(struct platfordrm_kms_helper_poll_fini (ddev);drm_mode_config_cleanup (ddev); -drm_vblank_cleanup (ddev);drm_dev_unref (ddev);
@@ -305,7 +304,7 @@ static int rcar_du_probe(struct platformreturn -ENODEV ; } -/* Allocate and initialize the DRM and R-Car device structures. */ +/* Allocate and initialize the R-Car device structure. */ rcdu =devm_kzalloc (&pdev->dev,sizeof (*rcdu),GFP_KERNEL );if (rcdu ==NULL )return -ENOMEM ;
@@ -315,31 +314,22 @@ static int rcar_du_probe(struct platform rcdu->dev = &pdev->dev; rcdu->info =of_match_device (rcar_du_of_table, rcdu->dev)->data; - ddev =drm_dev_alloc (&rcar_du_driver, &pdev->dev); -if (IS_ERR (ddev)) -return PTR_ERR (ddev); - - rcdu->ddev = ddev; - ddev->dev_private = rcdu; -platform_set_drvdata (pdev, rcdu);/* I/O resources */ mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); rcdu->mmio =devm_ioremap_resource (&pdev->dev, mem); -if (IS_ERR (rcdu->mmio)) { - ret =PTR_ERR (rcdu->mmio); - goto error; - } - -/* Initialize vertical blanking interrupts handling. Start with vblank -* disabled for all CRTCs. -*/ - ret =drm_vblank_init (ddev, (1 << rcdu->info->num_crtcs) -1 ); -if (ret <0 ) - goto error; +if (IS_ERR (rcdu->mmio)) +return PTR_ERR (rcdu->mmio);/* DRM/KMS objects */ + ddev =drm_dev_alloc (&rcar_du_driver, &pdev->dev); +if (IS_ERR (ddev)) +return PTR_ERR (ddev); + + rcdu->ddev = ddev; + ddev->dev_private = rcdu; + ret =rcar_du_modeset_init (rcdu);if (ret <0 ) {if (ret != -EPROBE_DEFER )
drivers/gpu/drm/rcar-du/rcar_du_kms.c +7 -0
@@ -567,6 +567,13 @@ int rcar_du_modeset_init(struct rcar_du_if (ret <0 )return ret; +/* Initialize vertical blanking interrupts handling. Start with vblank +* disabled for all CRTCs. +*/ + ret =drm_vblank_init (dev, (1 << rcdu->info->num_crtcs) -1 ); +if (ret <0 ) +return ret; +/* Initialize the groups. */ num_groups =DIV_ROUND_UP (rcdu->num_crtcs,2 );
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/drm-rcar-du-simplify-and-fix-probe-error-handling.patch