Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Matthew Auld <matthew.auld@intel.com>
Subject: Re: [PATCH] drm/i915: Call i915_perf_fini() on init_hw error unwind
Date: Sat, 14 Apr 2018 08:40:29 -0700	[thread overview]
Message-ID: <ae52a339-bdc4-a144-36ae-c0466a4e23fd@intel.com> (raw)
In-Reply-To: <20180414091233.32224-1-chris@chris-wilson.co.uk>

On 14/04/18 02:12, Chris Wilson wrote:
> We have to cleanup after i915_perf_init(), even on the error path, as it
> passes a pointer into the module to the sysfs core. If we fail to
> unregister the sysctl table, we leave a dangling pointer which then may
> explode anytime later the sysctl table, we leave a dangling pointer
> which then may explode anytime later.
>
> Fixes: 9f9b2792b6d3 ("drm/i915/perf: reuse timestamp frequency from device info")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>

Thanks a lot!

> ---
>   drivers/gpu/drm/i915/i915_drv.c | 21 +++++++++++----------
>   1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 9944a03cdea6..beac565ddfe0 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1109,30 +1109,30 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv)
>   
>   	ret = i915_ggtt_probe_hw(dev_priv);
>   	if (ret)
> -		return ret;
> +		goto err_perf;
>   
>   	/* WARNING: Apparently we must kick fbdev drivers before vgacon,
>   	 * otherwise the vga fbdev driver falls over. */
>   	ret = i915_kick_out_firmware_fb(dev_priv);
>   	if (ret) {
>   		DRM_ERROR("failed to remove conflicting framebuffer drivers\n");
> -		goto out_ggtt;
> +		goto err_ggtt;
>   	}
>   
>   	ret = i915_kick_out_vgacon(dev_priv);
>   	if (ret) {
>   		DRM_ERROR("failed to remove conflicting VGA console\n");
> -		goto out_ggtt;
> +		goto err_ggtt;
>   	}
>   
>   	ret = i915_ggtt_init_hw(dev_priv);
>   	if (ret)
> -		return ret;
> +		goto err_ggtt;
>   
>   	ret = i915_ggtt_enable_hw(dev_priv);
>   	if (ret) {
>   		DRM_ERROR("failed to enable GGTT\n");
> -		goto out_ggtt;
> +		goto err_ggtt;
>   	}
>   
>   	pci_set_master(pdev);
> @@ -1143,7 +1143,7 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv)
>   		if (ret) {
>   			DRM_ERROR("failed to set DMA mask\n");
>   
> -			goto out_ggtt;
> +			goto err_ggtt;
>   		}
>   	}
>   
> @@ -1161,7 +1161,7 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv)
>   		if (ret) {
>   			DRM_ERROR("failed to set DMA mask\n");
>   
> -			goto out_ggtt;
> +			goto err_ggtt;
>   		}
>   	}
>   
> @@ -1197,13 +1197,14 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv)
>   
>   	ret = intel_gvt_init(dev_priv);
>   	if (ret)
> -		goto out_ggtt;
> +		goto err_ggtt;
>   
>   	return 0;
>   
> -out_ggtt:
> +err_ggtt:
>   	i915_ggtt_cleanup_hw(dev_priv);
> -
> +err_perf:
> +	i915_perf_fini(dev_priv);
>   	return ret;
>   }
>   


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-04-14 15:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-14  9:12 [PATCH] drm/i915: Call i915_perf_fini() on init_hw error unwind Chris Wilson
2018-04-14  9:18 ` ✗ Fi.CI.BAT: failure for " Patchwork
2018-04-14 15:28   ` Arkadiusz Hiler
2018-04-14 15:40 ` Lionel Landwerlin [this message]
2018-04-14 15:59 ` [PATCH] " Michal Wajdeczko
2018-04-17 13:53   ` Chris Wilson
2018-04-14 16:28 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-04-14 17:43 ` ✓ Fi.CI.IGT: " Patchwork

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=ae52a339-bdc4-a144-36ae-c0466a4e23fd@intel.com \
    --to=lionel.g.landwerlin@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.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