* [PATCH libdrm 1/3] freedreno: remove dead error path
@ 2017-07-30 20:27 Eric Engestrom
2017-07-30 20:27 ` [PATCH libdrm 2/3] freedreno/msm: " Eric Engestrom
2017-07-30 20:27 ` [PATCH libdrm 3/3] freedreno: prevent deadlock in " Eric Engestrom
0 siblings, 2 replies; 4+ messages in thread
From: Eric Engestrom @ 2017-07-30 20:27 UTC (permalink / raw)
To: dri-devel
`pipe` cannot be non-null, so the label reduces to a simple return.
Then, there is no point initialising `pipe` just to overwrite it before
anyone reads it.
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
---
freedreno/freedreno_pipe.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/freedreno/freedreno_pipe.c b/freedreno/freedreno_pipe.c
index 3f8c8342..e69cb28c 100644
--- a/freedreno/freedreno_pipe.c
+++ b/freedreno/freedreno_pipe.c
@@ -36,18 +36,18 @@
struct fd_pipe *
fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id)
{
- struct fd_pipe *pipe = NULL;
+ struct fd_pipe *pipe;
uint64_t val;
if (id > FD_PIPE_MAX) {
ERROR_MSG("invalid pipe id: %d", id);
- goto fail;
+ return NULL;
}
pipe = dev->funcs->pipe_new(dev, id);
if (!pipe) {
ERROR_MSG("allocation failed");
- goto fail;
+ return NULL;
}
pipe->dev = dev;
@@ -57,10 +57,6 @@ fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id)
pipe->gpu_id = val;
return pipe;
-fail:
- if (pipe)
- fd_pipe_del(pipe);
- return NULL;
}
void fd_pipe_del(struct fd_pipe *pipe)
--
Cheers,
Eric
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH libdrm 2/3] freedreno/msm: remove dead error path
2017-07-30 20:27 [PATCH libdrm 1/3] freedreno: remove dead error path Eric Engestrom
@ 2017-07-30 20:27 ` Eric Engestrom
2017-08-01 23:16 ` Rob Clark
2017-07-30 20:27 ` [PATCH libdrm 3/3] freedreno: prevent deadlock in " Eric Engestrom
1 sibling, 1 reply; 4+ messages in thread
From: Eric Engestrom @ 2017-07-30 20:27 UTC (permalink / raw)
To: dri-devel
`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(-)
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH libdrm 3/3] freedreno: prevent deadlock in error path
2017-07-30 20:27 [PATCH libdrm 1/3] freedreno: remove dead error path Eric Engestrom
2017-07-30 20:27 ` [PATCH libdrm 2/3] freedreno/msm: " Eric Engestrom
@ 2017-07-30 20:27 ` Eric Engestrom
1 sibling, 0 replies; 4+ messages in thread
From: Eric Engestrom @ 2017-07-30 20:27 UTC (permalink / raw)
To: dri-devel
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
---
freedreno/freedreno_bo.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c
index 10949ebf..7f8ea59c 100644
--- a/freedreno/freedreno_bo.c
+++ b/freedreno/freedreno_bo.c
@@ -138,6 +138,7 @@ fd_bo_from_dmabuf(struct fd_device *dev, int fd)
pthread_mutex_lock(&table_lock);
ret = drmPrimeFDToHandle(dev->fd, fd, &handle);
if (ret) {
+ pthread_mutex_unlock(&table_lock);
return NULL;
}
--
Cheers,
Eric
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH libdrm 2/3] freedreno/msm: remove dead error path
2017-07-30 20:27 ` [PATCH libdrm 2/3] freedreno/msm: " Eric Engestrom
@ 2017-08-01 23:16 ` Rob Clark
0 siblings, 0 replies; 4+ messages in thread
From: Rob Clark @ 2017-08-01 23:16 UTC (permalink / raw)
To: Eric Engestrom; +Cc: dri-devel@lists.freedesktop.org
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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-01 23:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-30 20:27 [PATCH libdrm 1/3] freedreno: remove dead error path Eric Engestrom
2017-07-30 20:27 ` [PATCH libdrm 2/3] freedreno/msm: " Eric Engestrom
2017-08-01 23:16 ` Rob Clark
2017-07-30 20:27 ` [PATCH libdrm 3/3] freedreno: prevent deadlock in " Eric Engestrom
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox