[Intel-gfx] [PATCH v2 3/6] drm/i915: tidy up initialisation failure paths (legacy)
Daniel Vetter
daniel at ffwll.ch
Mon Jan 25 10:23:01 PST 2016
On Mon, Jan 25, 2016 at 12:08:11PM +0000, Dave Gordon wrote:
> On 25/01/16 10:52, Chris Wilson wrote:
> >On Fri, Jan 22, 2016 at 11:10:08PM +0000, Dave Gordon wrote:
> >>+ if (ringbuf) {
> >> intel_stop_ring_buffer(ring);
> >>- WARN_ON(!IS_GEN2(ring->dev) && (I915_READ_MODE(ring) & MODE_IDLE) == 0);
> >>
> >>- intel_unpin_ringbuffer_obj(ring->buffer);
> >>- intel_ringbuffer_free(ring->buffer);
> >>+ if (ringbuf->virtual_start)
> >
> >Cleaner code, and more idiomatic, if we let unpin early return.
>
> Maybe, but that's not the way it was previously written, so I didn't change
> it around.
We unfortunately let a lot of these through ... Early returns are
preferred, if it's possible. Same for skips in loops using if (!cond)
continue;, it makes for much less right-leaning code.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the Intel-gfx
mailing list