Message ID | 20170730202740.27564-2-eric@engestrom.ch (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sun, Jul 30, 2017 at 4:27 PM, Eric Engestrom <eric@engestrom.ch> wrote: > `ring` cannot be non-null, so the label reduces to a simple return. > Then, there is no point initialising `ring` just to overwrite it before > anyone reads it. > > Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Rob Clark <robdclark@gmail.com> if you have push access, go ahead and push it yourself, otherwise let me know BR, -R > --- > freedreno/msm/msm_ringbuffer.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/freedreno/msm/msm_ringbuffer.c b/freedreno/msm/msm_ringbuffer.c > index c3b2eded..5b28feaa 100644 > --- a/freedreno/msm/msm_ringbuffer.c > +++ b/freedreno/msm/msm_ringbuffer.c > @@ -589,12 +589,12 @@ drm_private struct fd_ringbuffer * msm_ringbuffer_new(struct fd_pipe *pipe, > uint32_t size) > { > struct msm_ringbuffer *msm_ring; > - struct fd_ringbuffer *ring = NULL; > + struct fd_ringbuffer *ring; > > msm_ring = calloc(1, sizeof(*msm_ring)); > if (!msm_ring) { > ERROR_MSG("allocation failed"); > - goto fail; > + return NULL; > } > > if (size == 0) { > @@ -614,8 +614,4 @@ drm_private struct fd_ringbuffer * msm_ringbuffer_new(struct fd_pipe *pipe, > ring_cmd_new(ring, size); > > return ring; > -fail: > - if (ring) > - fd_ringbuffer_del(ring); > - return NULL; > } > -- > Cheers, > Eric > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff --git a/freedreno/msm/msm_ringbuffer.c b/freedreno/msm/msm_ringbuffer.c index c3b2eded..5b28feaa 100644 --- a/freedreno/msm/msm_ringbuffer.c +++ b/freedreno/msm/msm_ringbuffer.c @@ -589,12 +589,12 @@ drm_private struct fd_ringbuffer * msm_ringbuffer_new(struct fd_pipe *pipe, uint32_t size) { struct msm_ringbuffer *msm_ring; - struct fd_ringbuffer *ring = NULL; + struct fd_ringbuffer *ring; msm_ring = calloc(1, sizeof(*msm_ring)); if (!msm_ring) { ERROR_MSG("allocation failed"); - goto fail; + return NULL; } if (size == 0) { @@ -614,8 +614,4 @@ drm_private struct fd_ringbuffer * msm_ringbuffer_new(struct fd_pipe *pipe, ring_cmd_new(ring, size); return ring; -fail: - if (ring) - fd_ringbuffer_del(ring); - return NULL; }
`ring` cannot be non-null, so the label reduces to a simple return. Then, there is no point initialising `ring` just to overwrite it before anyone reads it. Signed-off-by: Eric Engestrom <eric@engestrom.ch> --- freedreno/msm/msm_ringbuffer.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)