Re: [PATCH] drm/i915: Replace has_bsd/blt/vebox with a mask

Chris Wilson
2013-10-15T08:50:44Z

On Mon, Oct 14, 2013 at 08:46:22PM -0700, Ben Widawsky wrote:
> -cleanup_vebox_ring:
> - intel_cleanup_ring_buffer(&dev_priv->ring[VECS]);
> -cleanup_blt_ring:
> - intel_cleanup_ring_buffer(&dev_priv->ring[BCS]);
> -cleanup_bsd_ring:
> - intel_cleanup_ring_buffer(&dev_priv->ring[VCS]);
> -cleanup_render_ring:
> - intel_cleanup_ring_buffer(&dev_priv->ring[RCS]);
> +cleanup:
> + for_each_ring(ring, dev_priv, i) {
> + if (!(INTEL_INFO(dev)->ring_mask & (1<<i)) ||
> + !ring->name)
> + continue;

This looks dubious. You don't need to check ring_mask here as that will
be implicit in whatever we test for completeness. ring->name is set at
the start of initialisation and is not cleaned upon error. A better
choice is ring->obj, which we already check in
intel_cleanup_ring_buffer.

So this becomes:
cleanup:
for_each_ring(ring, dev_priv, i)
> + intel_cleanup_ring_buffer(ring);

-Chris

--
Chris Wilson, Intel Open Source Technology Centre